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. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 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
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@ then you won't see the grants for root@%.

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

share|improve this answer


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

Your Answer


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.