不幸的是,我有一个破折号的数据库名称。 当mysql报告语法错误时,如何授予对该数据库的访问权限。
例如
GRANT SELECT,INSERT,UPDATE,DELETE ON astpp.* TO 'portal'@'localhost' IDENTIFIED BY 'Ab7g12Xh35' WITH GRANT OPTION;
作品,但是
GRANT SELECT,INSERT,UPDATE,DELETE ON astpp-eth01.* TO 'portal'@'localhost' IDENTIFIED BY 'Ab7g12Xh35' WITH GRANT OPTION;
才不是。
也不:
GRANT SELECT,INSERT,UPDATE,DELETE ON 'astpp-eth01'.* TO 'portal'@'localhost' IDENTIFIED BY 'Ab7g12Xh35' WITH GRANT OPTION;
在mysql上,除非启用了ANSI_QUOTES,否则用反引号字符转义数据库列名称。 请参阅http://dev.mysql.com/doc/refman/5.0/en/identifiers.html 。
尝试使用这样的命令。
grant select,insert,update,delete on `astpp-eth01`.* to 'portal'@'localhost' identified by 'Ab7g12Xh35' with grant option;