mysql blocked because of many connection errors

背景

今天啓動服務的時候,發現有一個服務一直啓動不起來,報錯以下:java

Caused by: 
java.sql.SQLException: null,  
message from server: "Host '192.168.0.10' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'"

分析

這裏的錯誤已經很明確了,就說某一個ip產生了大量的錯誤連接,而後這個IP就被鎖了,若是要解除鎖定,就用mysql自帶的名命令'mysqladmin flush-hosts'解鎖便可。mysql

解決

方法一.經過提示,用命令'mysqladmin flush-hosts'。

若是是遠程機器,能夠使用: mysqladmin flush-hosts -h 192.168.1.9 -P 3306 -u root -p

方法二.進入mysql命令行,輸入'flush hosts'也是能夠的。以下圖所示:

圖片描述


最後別忘了:修改max_connection_errors參數,避免之後再出現這樣的問題

查看:show variables like 'max_connect_errors';
修改:set global max_connect_errors = 1000;
校驗:show variables like 'max_connect_errors';

圖片描述

相關文章
相關標籤/搜索