sysbench 压测无法连接MySQL 8.0
报错:
FATAL: unable to connect to MySQL server on host '127.0.0.1', port 3377, aborting...
FATAL: error 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
FATAL: `sysbench.cmdline.call_command' function failed: /usr/share/sysbench/oltp_common.lua:83: connection creation faile
sysbench 测试OLTP报上面错误,FATAL: error 2059: Authentication plugin 'caching_sha2_password' cannot be loaded:
认证组件“caching_sha2_password”没有被加载,在mysql 8.0 以后,用户连接默认认证组件改为“caching_sha2_password”,
mysql 5.7以前,默认的用户认证组件为“mysql_native_password”。
MySQL 8.0 调整密码验证规则(改为可以设置简单密码):
set global validate_password.policy=0;
set global validate_password.length=1;
create database sbtest;
CREATE USER 'yoon'@'%' IDENTIFIED BY 'hankyoon';
GRANT ALL ON *.* TO 'tony'@'%';
flush privileges;
若提示上面参数不存在,用如下方式:
mysql> select user,host,plugin,authentication_string from mysql.user where user = 'root' \G *************************** 1. row *************************** user: root host: localhost plugin: caching_sha2_password authentication_string: $A$005$@sQuHfw _n.O=uMu7uxyHg/fN/F4oFggtYfIOERF11GGQEjcAL0xFJHoCA 1 row in set (0.00 sec) mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY 'xxxxxxxxxx'; Query OK, 0 rows affected (0.01 sec) mysql> flush privileges; Query OK, 0 rows affected (0.01 sec) mysql> select user,host,plugin,authentication_string from mysql.user where user = 'root' \G *************************** 1. row *************************** user: root host: localhost plugin: mysql_native_password authentication_string: *AD04915810305F8091B9C67A0CCE68566BB80611
修改:
ALTER USER yoon IDENTIFIED WITH mysql_native_password; #这一步会把密码清空
alter user 'yoon'@'%' identified with mysql_native_password by 'hankyoon';
压测:
sysbench oltp_read_write --mysql-host=xxx.xxx.xxx.xxx --mysql-port=3377 --mysql-user=yoon --mysql-password='hankyoon' --mysql-db=sbtest --tables=30 --table-size=1000000 --threads=30 prepare
sysbench oltp_read_write --mysql-host=xxx.xxx.xxx.xxx --mysql-port=3377 --mysql-user=yoon --mysql-password='hankyoon' --mysql-db=sbtest --tables=30 --table-size=1000000 --threads=10 --time=60 --report-interval=10 run
分类:
MySQL
, MySQL Tools
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律