mysql 8 设置允许远程连接 You are not allowed to create a user with GRANT

出现问题:ERROR 1410 (42000): You are not allowed to create a user with GRANT

原因:当前user表中没有root - %记录; 可以更新root - localhost 为 root - %

MySQL [mysql]> update user set host = ‘%’ where user = ‘root’;
出现问题:ERROR 1062 (23000): Duplicate entry ‘%-root’ for key ‘PRIMARY’

原因显示:host+user 应该是联合主键,冲突了

5.解决方法:

MySQL [mysql]> update user set host = ‘%’ where user = ‘root’ and host=‘localhost’;

6.再次给用户root授权

MySQL [mysql]> GRANT ALL ON . TO ‘root’@’%’

MySQL [mysql]> flush privileges;

此时用navicat连接还是报错:Client does not support authentication protocol requested by server;

原因是mysql8默认的加密方式为caching_sha2_password 与mysql5的加密方式mysql_native_password 不同

7.解决方法-更新用户加密方式:

MySQL [mysql]> ALTER USER ‘root’@’%’ IDENTIFIED WITH mysql_native_password BY ‘密码’;

查询一下修改结果:MySQL [mysql]> select host,user,plugin from user;

其它:如果需要支持 root - localhost可以使用插入语句

MySQL [mysql]> insert user (user, host, ssl_cipher, x509_issuer, x509_subject) values(‘root’, ‘localhost’, ‘’, ‘’, ‘’);

再查看:(注意 ssl_cipher, x509_issuer, x509_subject这几个字段没有默认值,不设置会提示错误)

https://blog.csdn.net/mxskymx/article/details/88765072

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
MySQL 8.0中,如果要开启远程访问,并且出现"You are not allowed to create a user with GRANT"错误,可以按照以下步骤进行操作: 1. 首先,通过修改root用户的host字段来允许远程访问。使用以下命令: ``` MySQL [mysql]> update user set host = '%' where user = 'root' and host='localhost'; ``` 2. 接下来,为root用户设置密码,并使用mysql_native_password身份验证插件。使用以下命令: ``` MySQL [mysql]> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '密码'; ``` 这样,你就成功开启了MySQL 8.0的远程访问权限,并解决了"You are not allowed to create a user with GRANT"错误。请确保将'密码'替换为你想要设置的实际密码。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [MySql8.0开启远程root用户访问,解决You are not allowed to create a user with GRANT问题](https://blog.csdn.net/daobaqin/article/details/122094823)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [mysql 8 设置允许远程连接 You are not allowed to create a user with GRANT](https://blog.csdn.net/m0_67392811/article/details/123672458)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值