美文网首页
You are not allowed to create a

You are not allowed to create a

作者: 10676 | 来源:发表于2022-05-19 09:21 被阅读0次

    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没毛病,推上去直接干懵逼了,搞了半天,终于搞明白了

    我得程序终于不报错了

    相关文章

      网友评论

          本文标题:You are not allowed to create a

          本文链接:https://www.haomeiwen.com/subject/blzzurtx.html