Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Dec 2004 16:09:20 +0100
From:      "Jorn Argelo" <jorn@wcborstel.nl>
To:        John DeStefano <john.destefano@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: mysql connect problems
Message-ID:  <20041210145930.M75908@wcborstel.nl>
In-Reply-To: <f2160e0d04121006545c8e3dfb@mail.gmail.com>
References:  <f2160e0d041209141883a59af@mail.gmail.com> <20041209230429.M81198@wcborstel.nl> <f2160e0d04121006545c8e3dfb@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 10 Dec 2004 09:54:56 -0500, John DeStefano wrote
> On Fri, 10 Dec 2004 00:15:10 +0100, Jorn Argelo <jorn@wcborstel.nl> 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).

A little side note, you can always type mysql -u root -pyourpassword (note 
that there is no space between the two) as well.

> 
> > 
> > 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: ********
> ...it doesn't work:
> ERROR 1045 (28000): Access denied for user: 'mtuser'@'localhost'
> (Using password: YES)

You have to make sure that the user has access to login. Unless you are using 
this database on an important machine, you can always change the root password 
like this:

set password = password("yournewpassword");

Like that, you won't have problems with permissions and such, but people who 
put security at a top priority will not like this method.
> 
> >
> > > >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?

It's probably the best thing not to touch anything regarding the MySQL 
configuration unless you're sure what you're doing.

> 
> 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.

Probably the same problem as stated before. If you are going to use one global 
root user, do make sure that you only use the web-based interface in a LAN 
enviroment, or add mod_ssl to your apache configuration. You don't want to 
send such sensible passwords over the net in plain text.

If you want more information regarding the MySQL console, I would suggest you 
try the MySQL documentation located on their website. It's just as great as 
the FreeBSD handbook is ;)

Cheers,

Jorn



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041210145930.M75908>