Mysql – Myphpadmin Hiding Databases

MySQL

I have a client that wants to use myphpadmin to manage his mysql database 5.x on my server. I found this article on how to hide databases from myphpadmin but I don't like this because if I don't specify the databases to hide then every time I add a new database it because available to the client through myphpadmin.

Article: http://www.electrictoolbox.com/hide-databases-phpmyadmin/

Command to hide a database in the myphpadmin config.inc.php file:

 $cfg['Servers'][$i]['hide_db'] = 'hidedb1|hidedb2|etc...';

I also created a separate username and password in mysql to.

Is there a way to reverse this so I can tell myphpadmin what database to only show for this login?

Thanks,

Frank G.

Best Answer

MySQL user will see only the databases on which he has access right. You can test it

mysql> create database test_db;
mysql> grant all privileges on test_db.* to test_user@'%' identified by "password";

After that login with test_user and you will see only test_db database

What do I do if the user has three database that are already populated. How do I give him just access to those three?

first of all revoke all privileges

mysql> REVOKE ALL PRIVILEGES, GRANT OPTION FROM test_user@'%';
mysql> flush privileges;

and then grant to necessary db/tables/columns