Grant on multiple databases. MySQL

shurik2533 picture shurik2533 · Jul 8, 2010 · Viewed 21.7k times · Source

How to grant on multiple databases? MySQL.

Something like

GRANT SELECT,INSERT,UPDATE,DELETE,CREATE
ON 'databasesprefix%'.*
TO testuser@localhost IDENTIFIED BY 'testpasswd';

Answer

Ike Walker picture Ike Walker · Jul 8, 2010

You just need to use backticks instead of quotes around the db_name prefix.

I think this will work:

GRANT SELECT,INSERT,UPDATE,DELETE,CREATE
ON `databasesprefix%`.*
TO testuser@localhost IDENTIFIED BY 'testpasswd';