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之后再用修改的密码登录就可以。
9717

被折叠的 条评论
为什么被折叠?



