Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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

share|improve this answer
    
What do I do if the user has three database that are already populated. How do I give him just access to those three? –  Frank G. Aug 3 '13 at 18:58
    
okay I create a test db called "test123" and then I did the grant all priv to user test_user with the password set to password. Then I tried to login to phpmyadmin and it wont let me. I know the db is there and the user I see both. I also removed the phpmyadmin config file so that wont cause problems. But still wont let me in. Any suggestions? –  Frank G. Aug 3 '13 at 19:08
    
well that was educational. I figured it out and that is very helpful for future things like this so a big thank you to you for your help!!!! Thanks! –  Frank G. Aug 3 '13 at 19:15
    
You can see all privileges with "SHOW GRANTS FOR 'user'@'host';" –  ALex_hha Aug 3 '13 at 19:18
1  
A typical mysql user should have access for insert/update/delete records from db, for e.g wordpress user. If you have some special requirements then you should split the access, imho –  ALex_hha Aug 4 '13 at 9:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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