13

Unfortunately, I have a database name with a dash in it. How do I grant access to that database as mysql reports a syntax error.

e.g.

GRANT SELECT,INSERT,UPDATE,DELETE ON astpp.* TO 'portal'@'localhost'
IDENTIFIED BY 'Ab7g12Xh35' WITH GRANT OPTION;

works, but

GRANT SELECT,INSERT,UPDATE,DELETE ON astpp-eth01.* TO 'portal'@'localhost'
IDENTIFIED BY 'Ab7g12Xh35' WITH GRANT OPTION;

Does not.

Neither does:

GRANT SELECT,INSERT,UPDATE,DELETE ON 'astpp-eth01'.* TO 'portal'@'localhost'
IDENTIFIED BY 'Ab7g12Xh35' WITH GRANT OPTION;

1 Answer 1

27

On mysql you escape database column names with the backtick character unless you have ANSI_QUOTES enabled. See http://dev.mysql.com/doc/refman/5.0/en/identifiers.html.

Try using a command like this.

grant select,insert,update,delete on `astpp-eth01`.* to 'portal'@'localhost' identified by 'Ab7g12Xh35' with grant option;
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .