不允许使用 GRANT 创建用户

Amu*_*tia 6 mysql

我试图使用链接在 ubuntu 上安装 wordpress 并点击 https://ubuntu.com/tutorials/install-and-configure-wordpress#4-configure-database

当我运行此命令时,出现错误 -

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 1
Run Code Online (Sandbox Code Playgroud)

我尝试了几乎所有语法,wordpress@localhost'wordpress'@'localhost'

'root'我尝试删除并添加中的撇号IDENTIFIED BY 'root'

然后在搜索之后我也尝试了这个命令 - GRANT ALL PRIVILEGES ON *.* TO 'wordpress'@'localhost' IDENTIFIED BY 'root'并得到

错误 -ERROR 1410 (42000): You are not allowed to create a user with GRANT

没有发现任何对我有用的东西。请帮助我哪里做错了。谢谢

PS 数据库已经存在 -

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| wordpress          |
+--------------------+
5 rows in set (0.01 sec)
Run Code Online (Sandbox Code Playgroud)

小智 14

授予权限时无需包含该IDENTIFIED BY位。如果您需要创建用户授予权限,则需要两个操作:

mysql> CREATE USER 'wordpress'@'localhost' IDENTIFIED WITH mysql_native_password BY '{superSecretPassword!123}';
mysql> GRANT ALL ON `wordpress`.* TO 'wordpress'@'localhost';
Run Code Online (Sandbox Code Playgroud)

一定要将该superSecretPassword!123位更改为更好的东西。

  • 用户未创建,0 行受影响! (2认同)