问题:搭建mysql慢日志可视化监控平台Anemometer
cat /var/log/httpd/error_log
PHP Fatal error: Uncaught exception 'Exception' with message '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' in /var/www/html/anemometer/lib/AnemometerModel.php:282\nStack trace:\n#0 /var/www/html/anemometer/lib/Anemometer.php(65): AnemometerModel->connect_to_datasource()\n#1 /var/www/html/anemometer/index.php(36): Anemometer->__construct(Array)\n#2 {main}\n thrown in /var/www/html/anemometer/lib/AnemometerModel.php on line 282, referer: http://192.168.10.10/anemometer/
解决办法:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
ALTER USER 'anemometer'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
mysql> flush privileges;
重启mysql服务即可。