Page 1 of 1

Root access to database denied

Posted: Wed Apr 08, 2009 11:21 am
by pickle
Hi everyone,

I can login to my MySQL server just fine as root. I can create a database just fine. But when I try to grant privileges to said database, I get a 1044 error "Access denied for user 'root'@'localhost' to database 'session2'.

Checking the `mysql` database, the root user has the grant privilege both in the `user` and `db` tables.

The query I'm trying to run is:

Code: Select all

GRANT ALL ON `myDB`.* TO 'myUser'@'localhost' IDENTIFIED BY PASSWORD `myPass'
Any ideas? I'm suspecting a brain fart.

Re: Root access to database denied

Posted: Wed Apr 08, 2009 12:17 pm
by Christopher
Have you done a "FLUSH PRIVILEGES" to make the changes live?

Re: Root access to database denied

Posted: Wed Apr 08, 2009 1:50 pm
by pickle
I have, but I don't think it applies.

Permissions haven't changed, as the root user has rights to '%' databases, so when I make a new database, the privileges automatically apply.

Regardless, I have done that & there was no change.

Re: Root access to database denied

Posted: Wed Apr 08, 2009 3:36 pm
by Christopher
That does sound strange. Are there any entries in the mysql host table

Re: Root access to database denied

Posted: Wed Apr 08, 2009 3:50 pm
by pickle
Nope.

Re: Root access to database denied

Posted: Thu Apr 09, 2009 5:27 am
by VladSun
What about
[sql]GRANT ALL ON `myDB`.* TO myUser@localhost IDENTIFIED BY 'myPass'[/sql]

I.e.
- remove the quotes from user/host
- use text password instead of hash
- ` fixed to ' in `mypass'

Re: Root access to database denied

Posted: Thu Apr 09, 2009 9:55 am
by pickle
Same deal.

Re: Root access to database denied

Posted: Thu Apr 09, 2009 10:20 am
by VladSun
Try to run mysql_fix_privilege_tables

Re: Root access to database denied

Posted: Thu Apr 09, 2009 10:34 am
by pickle
Ran that, took a few seconds, and it didn't fix anything.

One thing that strikes me as odd is it's saying I'm denied access to the database 'session'. I thought the GRANT query just affected mysql.user and mysql.db? Those are the two tables I change when I manually create permission.

Re: Root access to database denied

Posted: Thu Apr 09, 2009 12:06 pm
by VladSun
Yes, it's odd.
Do you have a 'session2' database indeed?

Try to restart MySQL.

Re: Root access to database denied

Posted: Thu Apr 09, 2009 1:55 pm
by pickle
Yes, the database exists. I create it immediately before trying to grant privileges.

I can't restart MySQL now - we've got lots of apps running on it. I'll try this evening & see what happens.

Thanks.