patternsqlMinor
Grant access on a database to all users
Viewed 0 times
allgrantdatabaseusersaccess
Problem
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
Even (for security reason), it can be
GRANT ALL ON my_database.* TO *@localhost;Even (for security reason), it can be
read permission only.Solution
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';Code Snippets
GRANT ALL ON my_database.* TO ''@'localhost';Context
StackExchange Database Administrators Q#56216, answer score: 4
Revisions (0)
No revisions yet.