问题:connection to database 'zabbix' failed: [2059] Authentication plugin 'caching_sha2_password' cannot be loaded
一.修改zabbix用户的加密方式
zabbix-server日志报错如下:
38865:20220823:153852.724 VMware monitoring: NO
38865:20220823:153852.724 SMTP authentication: NO
38865:20220823:153852.724 ODBC: NO
38865:20220823:153852.724 SSH support: NO
38865:20220823:153852.724 IPv6 support: NO
38865:20220823:153852.724 TLS support: NO
38865:20220823:153852.724 ******************************
38865:20220823:153852.724 using configuration file: /usr/local/zabbix/etc/zabbix_server.conf
38865:20220823:153852.729 [Z3001] connection to database 'zabbix' failed: [2059] 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
38865:20220823:153852.729 Cannot connect to the database. Exiting...
1.登录mysql数据库,查看加密方式
mysql> show variables like 'default_authentication_plugin';+-------------------------------+-----------------------+| Variable_name | Value |+-------------------------------+-----------------------+| default_authentication_plugin | caching_sha2_password |+-------------------------------+-----------------------+1 row in set (0.03 sec)————————————————
2.查看本地mysql用户信息
mysql> select host,user,plugin from mysql.user;
+-----------+------------------+-----------------------+
| host | user | plugin |
+-----------+------------------+-----------------------+
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session | caching_sha2_password |
| localhost | mysql.sys | caching_sha2_password |
| localhost | root | mysql_native_password |
| localhost | zabbix | caching_sha2_password |
+-----------+------------------+-----------------------+
4 rows in set (0.00 sec)
3.修改加密方式
mysql> ALTER USER 'zabbix'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root_password';
Query OK, 0 rows affected (0.04 sec)
4.再次查看加密方式
mysql> select host,user,plugin from mysql.user;
+-----------+------------------+-----------------------+
| host | user | plugin |
+-----------+------------------+-----------------------+
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session | caching_sha2_password |
| localhost | mysql.sys | caching_sha2_password |
| localhost | root | mysql_native_password |
| localhost | zabbix | mysql_native_password |
+-----------+------------------+-----------------------+