MySQL root user can't access database

Posted by Ed Schofield on Server Fault See other posts from Server Fault or by Ed Schofield
Published on 2011-01-04T01:44:56Z Indexed on 2011/01/04 1:55 UTC
Read the original article Hit count: 239

Filed under:
|
|

Hi all,

We have a MySQL database ('myhours') on a production database server that is accessible to one user ('edsf') only, but not to the root user. The command 'SHOW DATABASES' as the root user does not list the 'myhours' database. The same command as the 'edsf' user lists the database:

mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| myhours            |
+--------------------+
2 rows in set (0.01 sec)

Only the 'edsf' user can access the 'myhours' database with 'USE myhours'. Neither user seems to have permission to grant further permissions for this database.

My questions are:

Q1. How is it that the root user does not have permission to use the database? How could this have come about? The output of

SHOW GRANTS FOR 'root'@'localhost';

looks fine to me:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*xxx' WITH GRANT OPTION

Q2. How can I recover this situation to make this database visible to the MySQL root user and grant further permissions on it?

Thanks in advance for any help!
-- Ed

© Server Fault or respective owner

Related posts about mysql

Related posts about database