日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql8 修改密码_sysbench压测软件连接mysql8失败案例分析

發(fā)布時(shí)間:2025/3/21 数据库 45 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql8 修改密码_sysbench压测软件连接mysql8失败案例分析 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

Mysql8出來有一段時(shí)間了,有很多新特性非常吸引人,于是就安裝好mysql-8.0.21數(shù)據(jù)庫嘗嘗鮮。數(shù)據(jù)庫是用二級制方式安裝的,安裝過程不復(fù)雜,如果想了解二進(jìn)制安裝詳細(xì)過程,可以在文章下方留言,我會(huì)更新一篇文章,詳細(xì)介紹安裝過程和mysql8的參數(shù)。

mysql-8.0.21數(shù)據(jù)庫安裝好之后,就試著用sysbench建張10W記錄的表,測試一下降序索引特性。

首先在數(shù)據(jù)庫中創(chuàng)建了用于壓測的數(shù)據(jù)庫和用戶

create database sbtest;CREATE USER 'tony'@'%' IDENTIFIED BY 'tony';GRANT ALL ON *.* TO 'tony'@'%';flush privileges;

數(shù)據(jù)庫和用戶都創(chuàng)建好之后,就用sysbench插入測試數(shù)據(jù)

sysbench /usr/share/sysbench/tests/include/oltp_legacy/oltp.lua --mysql-socket=/data/mysql/mysql8/run/3308/mysql.sock --mysql-user=tony --mysql-password='tony' --mysql-db=sbtest --oltp-test-mode=complex --oltp-tables-count=1 --oltp-table-size=100000 --threads=128 --oltp-nontrx-mode=select --oltp-read-only=off --max-time=120 --report-interval=5 prepareFATAL: unable to connect to MySQL server on socket '/data/mysql/mysql8/run/3308/mysql.sock', 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 directoryFATAL: `prepare' function failed: /usr/share/sysbench/tests/include/oltp_legacy/common.lua:111: Failed to connect to the database

可是報(bào)錯(cuò)了,FATAL: error 2059: Authentication plugin 'caching_sha2_password' cannot be loaded:,認(rèn)證組件“caching_sha2_password”沒有被加載,查了一下資料,原來在mysql8以后,用戶連接默認(rèn)認(rèn)證組件改為“caching_sha2_password”,而mysql5.7以前,默認(rèn)的用戶認(rèn)證組件為“mysql_native_password”。

既然知道了原因,就臨時(shí)將tony用戶的認(rèn)證組件修改“mysql_native_password”,然后運(yùn)行sysbench插入數(shù)據(jù)

ALTER USER tony IDENTIFIED WITH mysql_native_password;flush privileges;[mysql@mysql ~]$ sysbench /usr/share/sysbench/tests/include/oltp_legacy/oltp.lua --mysql-socket=/data/mysql/mysql8/run/3308/mysql.sock --mysql-user=tony --mysql-password='tony' --mysql-db=sbtest --oltp-test-mode=complex --oltp-tables-count=1 --oltp-table-size=100000 --threads=128 --oltp-nontrx-mode=select --oltp-read-only=off --max-time=120 --report-interval=5 prepareWARNING: --max-time is deprecated, use --time insteadsysbench 1.0.20 (using bundled LuaJIT 2.1.0-beta2)FATAL: unable to connect to MySQL server on socket '/data/mysql/mysql8/run/3308/mysql.sock', aborting...FATAL: error 1045: Access denied for user 'tony'@'localhost' (using password: YES)FATAL: `prepare' function failed: /usr/share/sysbench/tests/include/oltp_legacy/common.lua:111: Failed to connect to the database

竟然還報(bào)錯(cuò),這次是連接不上庫,為什么呢,檢查用戶是否正常

[root@localhost] 16:54:13 [performance_schema]>select user,host,plugin from mysql.user where user='tony';+------+------+-----------------------+| user | host | plugin |+------+------+-----------------------+| tony | % | mysql_native_password |+------+------+-----------------------+1 row in set (0.00 sec)

tony用戶的host是不限制IP段了,plugin也修改成mysql_native_password,難道是密碼不對

[root@localhost] 16:56:08 [performance_schema]>select user,host,plugin,authentication_string from mysql.user where user='tony';+------+------+-----------------------+-----------------------+| user | host | plugin | authentication_string |+------+------+-----------------------+-----------------------+| tony | % | mysql_native_password | |+------+------+-----------------------+-----------------------+1 row in set (0.71 sec)

看到這里,有沒有想說點(diǎn)什么,密碼竟然變成空了,原來執(zhí)行修改認(rèn)證組件命令時(shí),也將密碼置空了。

ALTER USER tony IDENTIFIED WITH mysql_native_password;

問題原因找到了,大家在生產(chǎn)操作時(shí)一定要注意,正確修改認(rèn)證組件命令如下所示

alter user 'tony'@'%' identified with mysql_native_password by 'tony';flush privileges;

搞不好,就會(huì)出現(xiàn)大片應(yīng)用連接不上數(shù)據(jù)庫的尷尬事情了。

總結(jié)

以上是生活随笔為你收集整理的mysql8 修改密码_sysbench压测软件连接mysql8失败案例分析的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。