?Plugin mysql_native_password reported: ''mysql_native_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
?show variables like 'default_authentication%';
?
?select host,user,plugin,authentication_string from mysql.user;
1.參考初步分析中的方案,將應(yīng)用的連接配置修改為正確的用戶信息;
2.可以在mysql數(shù)據(jù)庫中通過參數(shù)將該告警過濾,避免該告警信息輸入到錯誤日志文件。相關(guān)配置如下:
show variables like 'log_error_suppression_list';
set global log_error_suppression_list='MY-013360;
show variables like 'log_error_suppression_list';
注意,使用該方案也會導(dǎo)致某個存在且使用SHA256_PASSWORD認(rèn)證插件產(chǎn)生的告警??梢宰鳛榕R時方案;
3.修改mysql代碼,避免在使用不存在用戶登錄數(shù)據(jù)庫時,選擇 SHA256_PASSWORD認(rèn)證插件。目前針對該方案已提交Bug #109635。
或者文章來源:http://www.zghlxwxcb.cn/news/detail-731826.html
sha256_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead
?
mysql server errorlog忽然爆出大量的sha256_password' is deprecated and will be removed in a future release.錯誤,導(dǎo)致error不停寫入報錯信息
?
2021-07-11T13:17:25.067300Z 2385 [Warning] [MY-013360] [Server] Plugin sha256_password reported: ''sha256_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
........
...............
............................
2021-07-11T13:17:31.197610Z 2417 [Warning] [MY-013360] [Server] Plugin sha256_password reported: ''sha256_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
?
?
1.首先的排查思路是要查清楚什么原因?qū)е碌拇罅繄箦e,瘋狂的寫入日志,從報錯看有點像bug,但最后打消了這個念頭此版本是MySQL-8.0.25最新的GA,不應(yīng)該有這么低級的錯誤
?
然后梳理下面排查思路,從字面上看是sha256_password以后不被支持了,所以不斷的報錯,是什么原因出發(fā)這個報錯呢,很可能是老的程序客戶端使用的加密方式與MySQL 8.0.25的加密方式不兼容導(dǎo)致的
那么我們就從連接方向來排查,首先要找到哪些客戶端和程序連接到MySQL,導(dǎo)致的報錯
?
首先查詢本地下加密方式,所有用戶使用的都是caching_sha2_password,也是MySQL 8.0建議的加密方式
?
mysql> show variables like '%auth%';
+-------------------------------+-----------------------+
| Variable_name ? ? ? ? ? ? ? ? | Value ? ? ? ? ? ? ? ? |
+-------------------------------+-----------------------+
| default_authentication_plugin | caching_sha2_password |
+-------------------------------+-----------------------+
?
mysql> select user,host,plugin from mysql.user;
+------------------+--------------+-----------------------+
| user ? ? ? ? ? ? | host ? ? ? ? | plugin ? ? ? ? ? ? ? ?|
+------------------+--------------+-----------------------+
| repl ? ? ? ? ? ? | % ? ? ? ? ? ?| caching_sha2_password |
| root ? ? ? ? ? ? | 127.0.0.1 ? ?| caching_sha2_password |
| NC ? ? ? ? ? ? ? | 192.168.200.%| caching_sha2_password |
| mysql.infoschema | localhost ? ?| caching_sha2_password |
| mysql.session ? ?| localhost ? ?| caching_sha2_password |
| mysql.sys ? ? ? ?| localhost ? ?| caching_sha2_password |
| root ? ? ? ? ? ? | localhost ? ?| caching_sha2_password |
+------------------+--------------+-----------------------+
7 rows in set (0.00 sec)
2.可以從查詢connection_control_failed_login_attempts表來確定哪些客戶端在連接MySQL和連接報錯
mysql> select * from information_schema.connection_control_failed_login_attempts;
ERROR 1109 (42S02): Unknown table 'CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS' in information_schema
?
默認(rèn)情況下connection_control_failed_login_attempts沒有被啟用,我們需要安裝connection_control.so插件來獲取查詢支持
?
mysql> INSTALL PLUGIN CONNECTION_CONTROL SONAME 'connection_control.so';
Query OK, 0 rows affected (0.00 sec)
?
?
mysql> INSTALL PLUGIN CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS SONAME 'connection_control.so';
Query OK, 0 rows affected (0.00 sec)
安裝好后查看默認(rèn)配置
mysql> show variables like 'connection_control%';
+-------------------------------------------------+------------+
| Variable_name ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | Value ? ? ?|
+-------------------------------------------------+------------+
| connection_control_failed_connections_threshold | 3 ? ? ? ? ?|
| connection_control_max_connection_delay ? ? ? ? | 2147483647 |
| connection_control_min_connection_delay ? ? ? ? | 1000 ? ? ? |
+-------------------------------------------------+------------+
?
01.connection_control_failed_connections_threshold :連續(xù)失敗最大次數(shù)3次,0表示不開啟
02.connection_control_max_connection_delay :超過最大失敗次數(shù)之后阻塞登錄最大時間(毫秒)
03.connection_control_min_connection_delay :超過最大失敗次數(shù)之后阻塞登錄最小時間(毫秒)
?
?
3.通過查詢我們可以看到兩個網(wǎng)段的程序一個是mysqlrouter一個是nc的程序不斷嘗試連接MySQL,很可能是他們的連接加密方式問題導(dǎo)致的
?
mysql> ?select * from information_schema.connection_control_failed_login_attempts;
+-----------------------------------------------+-----------------+
| USERHOST ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| FAILED_ATTEMPTS |
+-----------------------------------------------+-----------------+
| 'mysql_router5_da1ufs1lvt0b'@'172.16.200.153' | ? ? ? ? ? ? ?22 |
| 'NCAPP'@'192.168.200.153' ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? ? 1154|
+-----------------------------------------------+-----------------+
2 rows in set (0.00 sec)
?
?
4.經(jīng)過排查和確認(rèn),NC程序的加密方式與MySQL 8.0.25 caching_sha2_password 不兼容導(dǎo)致的,可以通過使用 mysql_native_password 創(chuàng)建用戶嘗試避開不兼容的問題
?
?文章來源地址http://www.zghlxwxcb.cn/news/detail-731826.html
到了這里,關(guān)于Plugin mysql_native_password reported: ‘‘mysql_native_password‘ is deprecated and will be removed i的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!