解决mysql8.0因密码认证插件导致的链接不上

栏目: 数据库 · 发布时间: 5年前

内容简介:今天在迁移zabbix的数据库,每次链接到自己的mysql都报错,

解决 <a href='https://www.codercto.com/topics/18746.html'>mysql</a> 8.0因密码认证插件导致的链接不上

今天在迁移zabbix的数据库,每次链接到自己的mysql都报错,

mysqlAuthentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib64/mysql/plugin/caching_sha2_password

zabbix总是提示

**** MySQL server is not available. Waiting 5 seconds...

在经过了解决网络配置相关的问题之后,最终发现是密码加密方式的问题

操作

mysql 8.0 数据库默认的认证插件是

default_authentication_plugin=caching_sha2_password

包括你使用mysqladmin去初始化数据库也是使用这个的,所以如果想让我们平常的mysql连接客户端也可以连接上mysql8的数据库那就要修改 default_authentication_plugin

所以我们修改my.cnf配置文件

加入

default-authentication-plugin=mysql_native_password

但是这个配置参数只对新的用户起作用,对于老的,比如root那就要重新设置一下密码

对与那个用户使用了哪种认证插件,你可以去mysql的用户表去查看plugin字段

mysql -u root -p

use mysql

select * from user;

接着我们修改root的认证插件

ALTER USER 'root'@'%' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'password';

之后就好了

欢迎关注Bboysoul的博客www.bboysoul.com

Have Fun


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Web Design in a Nutshell

Web Design in a Nutshell

Jennifer Niederst / O'Reilly Media, Inc. / 2006-02-21 / USD 34.99

Are you still designing web sites like it's 1999? If so, you're in for a surprise. Since the last edition of this book appeared five years ago, there has been a major climate change with regard to web......一起来看看 《Web Design in a Nutshell》 这本书的介绍吧!

MD5 加密
MD5 加密

MD5 加密工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试