You are not allowed to create a

2022-05-19  本文已影响0人  10676

mysql账号授权报错,

RROR 1410 (42000): You are not allowed to create a user with GRANT

上边的这个错误,看到没?遇到这个错误算你活该,是不是装了什么mysql8.0,但是好在你遇到了我,问题得以友善的解决解决:

grant all privileges on *.* to 'root'@'%' identified '123456;
提示错误:you have an error in you SQL syntax…………

原因是mysql8.0以后的版本,授权不能带密码

grant all privileges on *.* to 'root'@'%'
这样也报错:ERROR 1410 (42000): You are not allowed to create a user with GRANT

原因是8.0.11版本之后移除了grant 语句添加用户的功能,也就是说grant…只能适用于已存在的账户,不能通过 grant… 来添加账号了。

解决办法如下:
use mysql;
update user set host='%' where user='root';
grant all privileges on test.* to 'root'@'%';
flush privileges;
解决办法如上↑

其中,test是你要授权的账号,也可以

grant all privileges on *.* to 'root'@'%';
更改过程有图有真相

唉,天杀的XXX,好好的mysql非得弄个视图出来,然后偏偏测试环境装了个mysql8.0.12,本地5.X没毛病,推上去直接干懵逼了,搞了半天,终于搞明白了

我得程序终于不报错了
上一篇下一篇

猜你喜欢

热点阅读