尝试在 ubuntu 上设置 wordpress 并希望在 mysql 中授予权限

Trying to setup wordpress on ubuntu and want to grant privileges in mysql

正在尝试 运行 这个:

mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER
    -> ON wordpress.*
    -> TO wordpress@localhost
    -> IDENTIFIED BY 'root';

但是出现错误:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY 'root'' at line 4

是不是版本问题。执行此操作的替代方法是什么?

grant 命令不接受 identified by 子句。如果要创建用户,需要在单独的语句中创建,然后授予相关权限:

CREATE USER wordpress@localhost IDENTIFIED BY 'root';

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER
    ON wordpress.*
    TO wordpress@localhost;