Mysql – thesql grant select to ONE table on ALL database

MySQLpermissions

I have many tables with the same table structure. I want to create a user which can access one table in all of those databases. We are adding new databases frequently, so a wildcard would be preferred. Is something like this possible?

GRANT SELECT ON *.commonTable TO 'user'@'localhost';

Best Answer

http://dev.mysql.com/doc/refman/5.1/en/grant.html

From the documentation it doesn't appear that you can. you can do databaseName.*, but not *.tableName.

But if you're deploying multiple databases, perhaps in your deployment process you can create a line to have that user account get created. This also allows you to set passwords per database per user.