【MySQL】Host is blocked because of many connection errors
【問題描述】:
應用伺服器那邊發現連不到資料庫,檢視日誌發現報錯:
【解決方案】:
讀了日誌發現該錯誤與connection errors有關,查了一下max_connect_errors引數:
原來是10,果然太小了。
查了一下5.5文件,官方給出瞭解決方案:
However, once a host is blocked, flushing the host cache is the only way to unblock it.
在mysql中執行:
或執行指令:
即可透過【flushing the host cache】來解鎖這個“host”
然後調大連線錯誤數,避免再次發生此類問題:(為Dynamic Variable)
最後新增/修改my.cnf,增加:
後來繼續查了一下5.5的文件發現,其預設值就為10,而5.6.6以後的版本中,該預設值已經調到了100。
參考文件:
MySQL 5.5 Reference Manual / Chapter 5 MySQL Server Administration / 5.1.1 Server Option and Variable Reference
應用伺服器那邊發現連不到資料庫,檢視日誌發現報錯:
- selectSQL get mysql connection failed, err:Error: ER_HOST_IS_BLOCKED Host 'xx.xx.xx.xx' is blocked because of many connection errors ……
【解決方案】:
讀了日誌發現該錯誤與connection errors有關,查了一下max_connect_errors引數:
-
SELECT @@global.max_connect_errors;
-
+-----------------------------+
-
| @@global.max_connect_errors |
-
+-----------------------------+
-
| 10 |
-
+-----------------------------+
- 1 row in set (0.00 sec)
查了一下5.5文件,官方給出瞭解決方案:
However, once a host is blocked, flushing the host cache is the only way to unblock it.
在mysql中執行:
- mysql> FLUSH HOSTS;
- mysqladmin flush-hosts
然後調大連線錯誤數,避免再次發生此類問題:(為Dynamic Variable)
- mysql> SET @@global.max_connect_errors=100000;
最後新增/修改my.cnf,增加:
- max_connect_errors = 100000
後來繼續查了一下5.5的文件發現,其預設值就為10,而5.6.6以後的版本中,該預設值已經調到了100。
參考文件:
MySQL 5.5 Reference Manual / Chapter 5 MySQL Server Administration / 5.1.1 Server Option and Variable Reference
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29773961/viewspace-2079581/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【Mysql】MySql Host is blocked because of many connection errors;MySqlBloCError
- Mysql host is blocked because of many connection errors;unblock解決方法MySqlBloCError
- Mysql連線錯誤:Mysql Host is blocked because of many connection errorsMySqlBloCError
- 從原始碼解析ERROR 1129 (HY000):Host is blocked because of many connection errors原始碼ErrorBloC
- 【問題解決】java.sql.SQLException: null, message from server: “Host ‘xxx.xx.xx.xxx‘ is blocked because ofJavaSQLExceptionNullServerBloC
- MySQL異常刨析:ata source rejected establishment of connection, message from server: “Too many connectionMySqlServer
- Connection could not be established with host 求救
- Swift:Errors thrown from here are not handled because the enclosing catch is not exhaustiveSwiftError
- ssh: connect to host localhost port 22: Connection refusedlocalhost
- MySQL: Too many connectionsMySql
- mysql slave-skip-errorsMySqlError
- 【故障處理】ORA-12545: Connect failed because target hostAI
- ORA-12545: Connect failed because target host or object does not existAIObject
- EJB create時ConnectException: Connection refused to host:....問題Exception
- mysql connection refusedMySql
- RAC Connection Redirected To Wrong Host/IP ORA-12545
- Mysql 錯誤日誌出現大量[Warning] Aborted connection to db user host的解決思路MySql
- Oracle資料庫出現WARNING: too many parse errors告警的分析思路Oracle資料庫Error
- 坑:ssh: connect to host github.com port 22: Connection refusedGithub
- ssh問題:ssh_exchange_identification: Connection closed by remote hostIDEREM
- [20230104]Oracle too many parse errors PARSE ERROR.txtOracleError
- RAC Connection Redirected To Wrong Host/IP ORA-12545 [ID 364855.1]
- MySQL ERROR 1040: Too many connectionsMySqlError
- 【MySQL】Too many connections 案例一則MySql
- 記一次ORA-12545: Connect failed because target host or object does not existAIObject
- Check connection related issue of mysqlMySql
- 異常解決——GitLab : ssh: connect to host port 22: Connection refusedGitlab
- MySQL:Lost connection to MySQL server at 'readingMySqlServer
- Host 'localhost' is not allowed to connect to this MySQL serverlocalhostMySqlServer
- Oracle RAC的ORA-12545 Connect failed because target host or object does not exist問題OracleAIObject
- MySQL Study之–Mysql啟動失敗“mysql.host”薦MySql
- Dr.Elephant mysql connection errorMySqlError
- The connection to the server 10.10.0.2:6443 was refused - did you specify the right host or port?Server
- Connection to host as user root failed.ERROR: NMO not setuid-root (Unix-only)AIErrorUI
- mysql遠端連線 Host * is not allowed to connect to this MySQL serverMySqlServer
- MySQL-1130-host ... is not allowed to connect to this MySql serverMySqlServer
- mysql備份提示 too many open files Errornumber 24MySqlError
- 關於mysql的Too many connections問題MySql