美文网首页
mysql8 grant授权报错:ERROR 1410 (420

mysql8 grant授权报错:ERROR 1410 (420

作者: AsaGuo | 来源:发表于2019-06-27 15:18 被阅读0次

    问题说明:

    1. 在8.0以前,我们习惯使用以下命令授权远程连接操作:
    grant all privileges on *.* to 'root'@'%';
    
    1. 但在8.0以后,使用以上命令会报错:
    ERROR 1410 (42000): You are not allowed to create a user with GRANT
    

    分析原因:

    因为在8.0以后,这个特性已被移除,官方文档如下:

    原文:Using GRANT to modify account properties other than privilege assignments. This includes
    authentication, SSL, and resource-limit properties. Instead, establish such properties at account-creation
    time with CREATE USER or modify them afterward with ALTER USER.
    译文:使用grant修改账户权限分配以外的账户属性。包括认证,SSL,和资源限制配置等。取而代之的是创建用户create user或者创建后修改alter user的方式。

    解决方案:

    1. 使用以下命令可以成功,但无法远程登陆:
    grant all on *.* to 'root'@'localhost';
    
    1. 此时,可以使用以下2种方式,实现远程:
    -- 1. 使用alter user
    alter user set user.host='%' where user.user='root';
    -- 2. 使用create user
    create user 'userName'@'%' identified 'your_password';
    

    相关文章

      网友评论

          本文标题:mysql8 grant授权报错:ERROR 1410 (420

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