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 have a global database, as I all users should have access to it. Is it possible to grant permission on a database to all users? something like

GRANT ALL ON my_database.* TO *@localhost;

Even (for security reason), it can be read permission only.

share|improve this question
I answered a weird question like this for creating a table accessible to all users :… – RolandoMySQLDBA Jan 6 '14 at 22:35
up vote 1 down vote accepted

Yes, this is possible, though not recommended. You can create a user with an empty string as username, also known as the anonymous user. It matches any username. This is the only possibility, wildcards like in the hostname (i.e. 'user'@'') are not allowed.

GRANT ALL ON my_database.* TO ''@'localhost';
share|improve this answer

Annonymous user access means you can connect to your MySQL server without specifying any user name, this is not recommended in production environment, you should immediately remove anonymous user account from MySQL server.

You should always grant permission for each MySQL user based on their requirement for a specific database or table.

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.