MySQL/MariaDB – Limiting User to SELECT and SHOW Queries

mariadbMySQL

We have a support team member who we'd like to limit his access to our database. He has never caused any problems with UPDATE or DELETE but we'd like to limit him to SELECT/SHOW/etc if it's possible. Is there a way? I'm not talking about limiting the number of queries, but the types of queries he can run.

Best Answer

Use GRANT to give them the exact authority that you would like them to have. It sounds like they may only need SELECT. For global authority use:

GRANT SELECT ON *.* TO 'supportmember'@'localhost';

Or limit the authority to a specific database using:

GRANT SELECT ON specificdatabase.* TO 'supportmember'@'localhost';

Or to a specific table in a specific database:

GRANT SELECT ON specificdatabase.specifictable TO 'supportmember'@'localhost';