MySQL安装后登录报错:authentication plugin ‘caching_sha2_password‘ cannot be loaded:/usr/lib64/mysql/plugin/

MySQL安装后登录报错

authentication plugin 'caching_sha2_password' cannot be loaded:/usr/lib64/mysql/plugin/caching_sha2_password.so:cannot open shared object file:no such file or directory

解决办法:

1.首先修改配置文件 /etc/my.cnf 加入: skip-grant-tables

[mysqld]
basedir = /data/mysql
datadir = /data/mysql/data
socket = /tmp/mysql.sock
log-error = /data/mysql/data/error.log
pid-file = /data/mysql/data/mysql.pid
tmpdir = /tmp
port = 1234
lower_case_table_names = 1
max_allowed_packet=32M
default_authentication_plugin = mysql_native_password
log_bin_trust_function_creators = ON
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
skip-grant-tables
[client]
socket=/tmp/mysql.sock

2.加入skip-grant-tables 后使用 mysql -u root -p 登录,密码随便输入,敲回车进入。

#使用mysql数据库
use mysql;
#刷新权限,必须先刷新
flush privileges;
#更新root密码
ALTER USER 'root@localhost' IDENTIFIED WITH mysql_native_password BY 'Qwe123!';
#刷新权限
flush privileges;
#设置root用户任意登录
update user set host='%' where user='root';
#刷新权限
flush privileges;
#退出
exit;

3.退出之后把 /etc/my.cnf 文件里面的 skip-grant-tables 注释掉,重启mysql之后再用修改的密码登录就可以。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值