MySql Host is blocked because of many connection errors 問題的解決方法


錯誤日志:

message from server: "Host '10.250.112.141' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'"

原因:

  同一個ip在短時間內產生太多(超過mysql數據庫max_connection_errors的最大值)中斷的數據庫連接而導致的阻塞;

解決方法:

1、提高允許的max_connect_errors數量(這種方法不徹底,后期還可能導致異常出現):

  進入Mysql數據庫查看max_connect_errors: show variables like 'max_connect_errors';

    修改max_connect_errors的數量為1000: set global max_connect_errors = 1000;

    查看是否修改成功:show variables like 'max_connect_errors';

2、使用mysqladmin flush-hosts 命令清理一下hosts文件

  (1)如果是安裝在Linux主機上的,可以通過whereis mysqladmin查找mysqladmin的路徑

  使用命令修改:

           /usr/bin/mysqladmin flush-hosts -h 10.250.112.141 -uroot -p

  備注:

   配置有master/slave主從數據庫的要把主庫和從庫都修改一遍

 (2)如果是在數據庫連接軟件上也可以在命令列工具里修改,命令如下:flush hosts;
        mysql> flush hosts;

重新啟動程序,查看數據庫連接是否正常就好啦。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM