zoukankan      html  css  js  c++  java
  • mysql 8 设置允许远程连接 You are not allowed to create a user with GRANT

    1.登录mysql : mysql -u root -p

    2.输入密码: Enter password: xxxxx

    ------ Server version: 8.0.15 MySQL Community Server - GPL

    3.进入mysql数据库:use mysql;

    4.设置允许远程用户访问:

    MySQL [mysql]> GRANT ALL ON *.* TO 'root'@'%'

    出现问题: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这几个字段没有默认值,不设置会提示错误)


    ————————————————
    版权声明:本文为CSDN博主「星梦天河」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/mxskymx/article/details/88765072

    明天的你会感谢今天拼命奋斗的自己
  • 相关阅读:
    ES6语法记录
    关于Vue中 render: h => h(App) 的具体含义的理解
    在Vue中结合render函数渲染指定组件
    访问者模式(Visitor)_java实现
    自底向上集成 Bottom-Up
    基于功能集成 Function-Based
    分层集成(线性关系) Layers
    持续集成(高频集成、每日集成) Continuous/High-frequency
    Selenium实现点击click()
    Selenium自动化之点击下拉框选项操作
  • 原文地址:https://www.cnblogs.com/qzqdy/p/15375300.html
Copyright © 2011-2022 走看看