Having trouble with a mysql grant statement.
I want a user who has:
- readonly (select) privileges on tables that begin with either ‘abc’ or ‘xyz’
- AND has the ability to CREATE tables.
Here is what I currently have. The .* syntax is giving me errors:
GRANT CREATE, SELECT
ON db1.abc.* , db1.xyz.*
TO 'some_user'@'%'
IDENTIFIED BY 'some_password';
The dot is a separator in MySQL – so in “db1.abc.*” the “db1” is the db name and “abc” is the table name. The “*” is therefore what – a column? That’s the wrong syntax to specify columns.
As you can read about in http://dev.mysql.com/doc/refman/5.1/en/grant.html, you can see that you put column names in parens:
Also, you can’t wild-card table names – you’ll have to list out all the tables explicitly if you have more than one table with a name that begins with ‘abc’ or ‘xyz’.