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'm trying to execute the below command as root user to provide accessiblity from my application.

GRANT ALL ON communitycourts.* TO 'root'@'%' WITH GRANT OPTION;

But it returns 0 rows affected, but when I dont see this in result of SHOW GRANTS. Pelase help me

share|improve this question

migrated from serverfault.com Feb 21 '12 at 13:31

This question came from our site for system and network administrators.

    
Do you have the communitycourts database? Is it spelled exactly as in your command? –  Mircea Vutcovici Feb 21 '12 at 12:40
    
Are you using root for your application? Why? –  gbn Feb 21 '12 at 12:58
    
@gbn I have changed to other user now –  Selvakumar P Feb 21 '12 at 13:48

3 Answers 3

up vote 2 down vote accepted

Two points to add:

  1. It is recommended to use another user other than root to connect to your DB in your application. Try to use root account for administration only. This can be good only on testing machines.
  2. Don't forget to flush privileges for the changes to take effect. This is better than restarting mysql.
share|improve this answer
    
As you recommended, I created a another and given grant previleges to that user. It works now. Thanks –  Selvakumar P Feb 21 '12 at 13:47

0 rows affected is normal for a successful GRANT command. Unsuccessful ones will display an error.

If you see 1 warning after 0 rows affected you should type SHOW WARNINGS; and check whether the warning affects you or not. This one could:

Warning | 1285 | MySQL is started in --skip-name-resolve mode; you must restart it without this switch for this grant to work

The SHOW GRANTS command will only show the privileges that the user executing the command has. If you are logged in as root@localhost or root@192.168.0.1 then you won't see the grants for root@%.

Try SHOW GRANTS FOR 'root'@'%'; instead.

share|improve this answer

Either

  • communitycourts doesn't exist
  • 'root'@'%' doesn't exist
share|improve this answer

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.