I want to create a user 'projectA' that has the same permissions to every database named 'projectA_%'
I know its possible but MySQL doesn't like my syntax:
grant all on 'projectA\_%'.* to 'projectA'@'%';
Reference: http://dev.mysql.com/doc/refman/5.1/en/grant.html
GRANT USAGE ON *. * means "No privilege". In other word, the user has been created (with an entry in mysql. users table) with no privilege.
To GRANT ALL privileges to a user , allowing that user full control over a specific database , use the following syntax: mysql> GRANT ALL PRIVILEGES ON database_name. * TO 'username'@'localhost';
MySQL WildcardsA wildcard character is used to substitute one or more characters in a string. Wildcard characters are used with the LIKE operator. The LIKE operator is used in a WHERE clause to search for a specified pattern in a column.
If I use back-tics instead of single quotes in the syntax, it appears to work just fine:
grant all on `projectA\_%`.* to `projectA`@`%`;
GRANT ALL PRIVILEGES ON `projectA\_%`.* TO 'projectA'@'%' IDENTIFIED BY 'your_passwd';
back-tics are needed for the database name
Edited:Underscore is now escaped.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With