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'@'%';
![](https://img.haomeiwen.com/i20688241/c7a2e7d89b5b0005.png)
唉,天杀的XXX,好好的mysql非得弄个视图出来,然后偏偏测试环境装了个mysql8.0.12,本地5.X没毛病,推上去直接干懵逼了,搞了半天,终于搞明白了
![](https://img.haomeiwen.com/i20688241/043d33190f17d6cc.png)
网友评论