Providing multiple databases. MySQL

How to provide multiple databases? MySQL

Sort of

GRANT SELECT,INSERT,UPDATE,DELETE,CREATE
ON 'databasesprefix%'.*
TO testuser@localhost IDENTIFIED BY 'testpasswd';
+3
source share
2 answers

your example should work. from (5.5) manually :

The characters "_" and "%" are allowed when specifying database names in GRANT statements that grant privileges at the global or database level.

s %, corresponding to any number (even zero) of characters, and _matches exactly one character. if you want to use _in the name of your database, you should avoid it as \_. also see other reservations from the manual.

< UPDATE > , : , , ( "`" ) </ UPDATE >

+5

backticks db_name.

, :

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

Source: https://habr.com/ru/post/1753712/


All Articles