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

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

3 Answers 3


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.
  • As you recommended, I created a another and given grant previleges to that user. It works now. Thanks Commented Feb 21, 2012 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 [email protected] then you won't see the grants for root@%.

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



  • communitycourts doesn't exist
  • 'root'@'%' doesn't exist

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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