标签 mysql8 下的文章

MySQL8.0.21连接报错Plugin caching_sha2_password could not be loaded解决方法

MySQL8默认加密使用的是caching_sha2_password插件,

root@devops_db 17:54:  [mysql]> show variables like 'default_authentication_plugin';
+-------------------------------+-----------------------+
| Variable_name                 | Value                 |
+-------------------------------+-----------------------+
| default_authentication_plugin | caching_sha2_password |
+-------------------------------+-----------------------+
1 row in set (0.00 sec)

root@devops_db 17:55:  [mysql]>  select host,user,plugin from mysql.user;
+-----------+------------------+-----------------------+
| host      | user             | plugin                |
+-----------+------------------+-----------------------+
| %         | ice              | caching_sha2_password |
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session    | caching_sha2_password |
| localhost | mysql.sys        | caching_sha2_password |
| localhost | root             | caching_sha2_password |
+-----------+------------------+-----------------------+
5 rows in set (0.00 sec)

使用SQL客户端连接的时候就会报Plugin caching_sha2_password could not be loaded错误,常见有如下解决方法:
1、写入my.cnf文件后重启MySQL:

[mysqld]
default_authentication_plugin=mysql_native_password

2、兼容新老版本的认证方式:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'xxxxxx' PASSWORD EXPIRE NEVER; #修改加密规则 
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'xxxxxx'; #更新用户密码 
FLUSH PRIVILEGES; #刷新权限

3、创建用户时指定加密方式:

CREATE USER 'ice'@'10.10.%' IDENTIFIED WITH mysql_native_password BY 'password'; #加密方式为
GRANT ALL privileges on TESTDB.* to 'ice'@'10.10.%' with grant option;
FLUSH PRIVILEGES;

使用mysql_native_password插件加密即可链接,mysql_native_password也是5.7以下版本使用的加密方式。

CentOS7.8编译安装MySQL8.0.21

  Centos7.8安装的是minimal最小化版本,首先安装基础必需的软件包及更新下系统:

yum install gcc gcc-c++ gcc-g77 make autoconf automake ncurses ncurses-devel openssl openssl-devel bison cmake cmake3 -y

MySQL8.0需要用gcc的版本为 4.8以上,CentOS自带的版本比较低,通过yum安装的版本也低,参考下面升级GCC版本

升级GCC版本参考:https://mhl.xyz/Linux/update-gcc.html

MySQL8.0.21.png

添加mysql运行账号及数据保存目录

groupadd mysql
useradd -g mysql mysql -s /bin/false
mkdir -p /data/mysql/
mkdir -p /data/mysql_logs/binlog/
touch /data/mysql_logs/error.log
chown -R mysql:mysql /data/mysql/
chown -R mysql:mysql /data/mysql_logs/

---阅读剩余部分---

最新

分类

归档

评论

其它