MySQL升级8.0以上版本后,在用第三方库github.com/Go-SQL-Driver/MySQL打开数据库时会报错this authentication plugin is not supported,这是因为MySQL8.0版本修改了加密方式,所以只要修改一下密码的加密方式就可以了。

首先用root用户进入MySQL,修改root用户的密码和加密方式:这里修改密码为abc345

mysql> alter user root@localhost identified with mysql_native_password by 'abc345';
Query OK, 0 rows affected (0.13 sec)mysql>

查询当前所有用户:

mysql> select host,user,plugin from mysql.user;
+-----------+------------------+-----------------------+
| host      | user             | plugin                |
+-----------+------------------+-----------------------+
| 127.0.0.1 | Tom              | caching_sha2_password |
| localhost | Tom              | caching_sha2_password |
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session    | caching_sha2_password |
| localhost | mysql.sys        | caching_sha2_password |
| localhost | root             | mysql_native_password |
+-----------+------------------+-----------------------+
6 rows in set (0.00 sec)mysql>

这里总共查询出来6个用户,刚才修改的是第6个,也就是最后一个用户| localhost | root | mysql_native_password |的密码和加密方式。可以看到,该用户的加密方式mysql_native_password已经不同于上面的其他5个加密方式了。

再修改其他用户:

mysql> alter user Tom@127.0.0.1 identified with mysql_native_password by '456789';
Query OK, 0 rows affected (0.03 sec)mysql>

查看:

mysql> select host,user,plugin from mysql.user;
+-----------+------------------+-----------------------+
| host      | user             | plugin                |
+-----------+------------------+-----------------------+
| 127.0.0.1 | Tom              | mysql_native_password |
| localhost | Tom              | caching_sha2_password |
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session    | caching_sha2_password |
| localhost | mysql.sys        | caching_sha2_password |
| localhost | root             | mysql_native_password |
+-----------+------------------+-----------------------+
6 rows in set (0.00 sec)mysql>

之后重启MySQL,再次连接就可以了。

golang连接mysql报错:this authentication plugin is not supported 解决方案相关推荐

  1. navicat连接pgsql报错:authentication method 10 not supported

    navicat连接pgsql报错:authentication method 10 not supported 解决方案:找到pgsql的安装目录下的pg_hba.conf文件 用文本编辑器打开后做如 ...

  2. mysql8.x实践系列(3)Qt客户端连接mysql报错:Authentication plugin ‘caching_sha2_password‘ reported error

    一.现象描述 Qt客户端远程连接mysql8.x服务器,会报错: Authentication plugin 'caching_sha2_password' reported error:Authen ...

  3. python 连接mysql报错:mysql.connector.errors.NotSupportedError: Authentication plugin ‘caching_sha2_passw

    python 连接mysql报错:mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_passw ...

  4. navicat 连接 mysql 报错:client does not support authentication protocal requested by server

    标题 navicat 连接 mysql 报错:client does not support authentication protocal requested by server 转载自:https ...

  5. Navicat连接MySQL,出现2059 - authentication plugin ‘caching_sha2_password‘的解决方案

    Navicat连接MySQL,出现2059 - authentication plugin 'caching_sha2_password'的解决方案 参考文章: (1)Navicat连接MySQL,出 ...

  6. 登录mysql报错2059,navicat连接mysql报错2059如何解决

    navicat连接mysql报错2059,如下图所示: 网上查询过后,发现这个错误出现的原因是在mysql8之前的版本中加密规则为mysql_native_password,而在mysql8以后的加密 ...

  7. 登录mysql报错2059_navicat连接mysql报错2059的解决方法

    navicat连接mysql报错2059的解决方法 发布时间:2020-12-21 10:27:37 来源:亿速云 阅读:82 作者:小新 栏目:数据库 这篇文章给大家分享的是有关navicat连接m ...

  8. python连接数据库mysql失败_解决python连接mysql报错问题

    解决python连接mysql报错问题 最近跑python脚本时遇到一个问题,当sql语句中有中文时,执行python脚本报以下错误: Traceback (most recent call last ...

  9. 连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决方法

    连接mysql报错:Access denied for user 'root'@'localhost'(using password: YES)的解决方法 参考文章: (1)连接mysql报错:Acc ...

最新文章

  1. 技术图文:Python魔法方法之属性访问详解
  2. STL之优先级队列priority_queue
  3. powertool 使用学习总结
  4. 下列关于计算机图形的应用中 错误的是,计算机图形学题库及答案
  5. Android之判断网络状态(网络的连接,改变,和判断2G/3G/4G)
  6. 使用Sonatype Nexus搭建Maven镜像的几点注意事项
  7. HTML5 figure元素
  8. python split()函数
  9. 单片机ADC采样算法----中位值平均滤波法
  10. 腾讯否认微信测试语音消息进度调节​;监证会同意蚂蚁集团科创板IPO注册;React 17 正式版发布|极客头条
  11. google lab 深度学习_吴恩达、李飞飞等化身超级英雄!深度学习漫画第一卷现已开源...
  12. Amlogic_Android7.1 HDMI显示流程源码分析
  13. Python中简单的编程
  14. 让国外买家秒回复的询盘模板示例
  15. Nginx入门以及开源博客Tale的部署
  16. 打开word2010每次都要配置进度的解决办法
  17. 微信公众号HTML5接入腾讯云人脸核身
  18. 成都榆熙电子商务有限公司:旗舰店都有哪些优势?
  19. Maven学习(一)---Maven简介
  20. ios  关闭更新(第三方软件 添加描述文件)

热门文章

  1. FAT16文件系统结构扇区数据分析
  2. 软件测试面试-如何测试一个杯子(转)
  3. 区块链 - Geth 搭建私有网络-实战
  4. 工业安全的未来——IT与OT的融合
  5. angular2 表单
  6. 《Kinect应用开发实战:用最自然的方式与机器对话》一3.2 基于“管道”的系统架构...
  7. 成长型思维模式Not yet
  8. 每次都觉得很神奇的JS
  9. SQLIOSim 模拟SQLServer的行为来测试IO性能
  10. [Android] 基于 Linux 命令行构建 Android 应用(四):命令行构建