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 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 : dba.stackexchange.com/questions/43614/… –  RolandoMySQLDBA Jan 6 at 22:35

2 Answers 2

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'@'%.any.domain.de') 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

 
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.