Grant users access to mysql with a dash in the database name
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;
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;