1

I'm connecting to the mysql server as user 'someuser'. When I connect to the server from my localbox I get to see all the databases.

However, when I SSH into the server and login with 'someuser' and execute show databases; I only see two: information_schema and test

How can I view all the databases when I SSH into the DB as well?

show grants; shows the below

mysql> show grants;
| Grants for dev@localhost                                             |
 | GRANT USAGE ON *.* TO 'someuser'@'localhost' IDENTIFIED BY PASSWORD '*' |

Edit

When I SSH into the server and login to mysql using root then I can see all the databases fine.

9
  • can't u see database named mysql ? And what do u mean by "localbox"?
    – Manu
    Jul 24, 2013 at 18:00
  • how many instances of mysql is running? Are you sure you have connected to the same instance in both cases?
    – Slowcoder
    Jul 24, 2013 at 18:03
  • hmm to my knowledge I'm only running one. Jul 24, 2013 at 18:04
  • @Manu by localbox I mean my localmachine using which I connect to the server. Jul 24, 2013 at 18:04
  • @Omnipresent.. That machine is not showing you mysql database?
    – Manu
    Jul 24, 2013 at 18:05

1 Answer 1

1

GRANT USAGE is not what you want. According to the mysql documentation:

USAGE   Synonym for “no privileges”

It is used at the global level with GRANT to modify account attributes such as resource limits or SSL characteristics without affecting existing account privileges.

http://dev.mysql.com/doc/refman/5.1/en/grant.html

You need to grant actual privileges to your "someuser" user for the database the user needs to see. For example, if you grant select privileges on the mysql.*:

GRANT SELECT ON mysql.* 
TO someuser@localhost IDENTIFIED BY "somepassword";
FLUSH PRIVILEGES;

Now, someuser connected from localhost will be able to see the mysql database when executing

SHOW DATABASES;

However, you might want to reserve the access to the mysql database for root only.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.