Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have mysql db named "greats" with four tables as below

+---------------------+
| Tables_in_greatstat |
+---------------------+
| log                 |
| sitedet1            |
| siteindex           |
| user                |
| whois1              |
+---------------------+

Here i have decided to create an mysql user "test" and i want to give the access only for specific table of the db "greatstat". So, May i know how to grant specific table perm for an user in MYSQL ?

share|improve this question

1 Answer 1

First create the user

GRANT USAGE ON *.* TO test@'localhost' IDENTIFIED BY 'whateverpassword';

To grant only SELECT privilege to the siteindex table in the greatstat database

GRANT SELECT ON greatstat.siteindex TO test@'localhost';

To grant only SELECT privilege to the whois1 table in the greatstat database

GRANT SELECT ON greatstat.whois1 TO test@'localhost';

To grant all privileges to every table in the greatstat database

GRANT ALL PRIVILEGES ON greatstat.* TO test@'localhost';

Please read the MySQL Documentation on the GRANT command.

share|improve this answer
    
Thanks for info. You have say to give table privilege by executing multiple query. But , i want to execute in single query. –  Mughil Apr 2 '12 at 10:52

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.