mysql connect problems

John DeStefano john.destefano at
Fri Dec 10 06:54:59 PST 2004

On Fri, 10 Dec 2004 00:15:10 +0100, Jorn Argelo <jorn at> wrote:
> On Thu, 9 Dec 2004 17:18:38 -0500, John DeStefano wrote
> [snip]
> >
> > At a prompt, if I try to connect to mysql using the '-p' option like
> > this:
> > # mysql -u root -p
> > ... I can connect.
> Which makes sense. Because the -p option is for entering a password. And I
> don't think you'll have an empty root password ;)

I assumed "p" meant "password" in some respect, but didn't realize
until you pointed it out that it actually meant " _prompt_ for
password", and that no password must inherently be assumed (which
doesn't sound very secure).

> But if I try to connect without '-p' like this:
> > # mysql -u root
> > ... I get an error:
> > mysqladmin: connect to server at 'localhost' failed
> > error: 'Access denied for user: 'root'@'localhost' (Using password:
> > NO)'
> >
> What you're trying to do now is connecting with an empty password, and thus it
> refuses to connect. You always have to imply the -p option unless the password
> of your user is empty, but you DON'T want that.

But this seems to work only for root: when I try the same command
specifying one of the users I created:
# mysql -u wikiuser -p
Enter password: ******** doesn't work:
ERROR 1045 (28000): Access denied for user: 'mtuser'@'localhost'
(Using password: YES)

> > >From what I can gather, this has to do with setting passwords for
> > different aliases or incarnations of the host for a single user
> > (root).  I've tried every solution I've found for adding additional
> > connection settings for root (including more than one method for
> > changing the root password).  When I log into mysql as root, use the
> > mysql database, and run 'select user, password, host from user;' I
> > see multiple entries for root for different 'host' values
> > ('localhost', the actual host name, and '%').
> Well, I have checked it as well, and I have just the root user on localhost
> (with a different password then the one on the system though) and two
> anonymous users (so no username and no password) for localhost and the FQDM
> without any permissions. So I'm not really sure if the % is good or not.
> Perhaps you're running a different version then I am (I use 4.1.7).
Yes: I'm running 5.0.0-alpha (at least that's what I get back from
"mysqladmin -u root -p version").  So, do you recommend I try to
remove those extra root entries?

Also, how do I get these Web-based clients to connect to the accounts
and databases they require?  I have created a database for each
application, and a user and password for each, and tried to grant
permissions for each to connect to the respective database.  But it's
not working: both Web clients return "can't connect" errors.

More information about the freebsd-questions mailing list