mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; ERROR 1410 (42000): You are not allowed to create a user with GRANT

发布时间 2024-01-12 18:17:36作者: 不会游泳的鱼丶

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
ERROR 1410 (42000): You are not allowed to create a user with GRANT

 

解决办法  以下是 8.0版本的错误信息

 

ERROR 1410 (42000): You are not allowed to create a user with GRANT
mysql> validate_password.length = 6
-> ;
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 'validate_password.length = 6' at line 1
mysql> set validate_password.length = 6
-> ;
ERROR 1229 (HY000): Variable 'validate_password.length' is a GLOBAL variable and should be set with SET GLOBAL

 

# 设置密码短一点


mysql> set global validate_password.length = 6
-> ;
Query OK, 0 rows affected (0.00 sec)

mysql> set global validate_password.policy = LOW
-> ;
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
ERROR 1410 (42000): You are not allowed to create a user with GRANT

 

创建个新的用户 


mysql> CREATE USER 'admin'@'%' IDENTIFIED BY 'MyNewPass4!';
Query OK, 0 rows affected (0.02 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%';
Query OK, 0 rows affected (0.03 sec)

 

 

然后使用admin进行远程登录的账户