MySQL root user can't access database
- by Ed Schofield
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