mysqladmin flush-hosts 解决方法
2019獨角獸企業重金招聘Python工程師標準>>>
同一個ip在短時間內產生太多(超過mysql數據庫max_connection_errors的最大值)中斷的數據庫連接而導致的阻塞;
解決方法:
1、提高允許的max_connection_errors數量(治標不治本):
① 進入Mysql數據庫查看max_connection_errors: show variables like '%max_connection_errors%';
?? ② 修改max_connection_errors的數量為1000: set global max_connect_errors = 1000;
③ 查看是否修改成功:show variables like '%max_connection_errors%';
2、使用mysqladmin flush-hosts 命令清理一下hosts文件(不知道mysqladmin在哪個目錄下可以使用命令查找:whereis mysqladmin);
① 在查找到的目錄下使用命令修改:/usr/bin/mysqladmin flush-hosts -h192.168.1.1 -P3308 -uroot -prootpwd;
備注:
其中端口號,用戶名,密碼都可以根據需要來添加和修改;
配置有master/slave主從數據庫的要把主庫和從庫都修改一遍的(我就吃了這個虧明明很容易的幾條命令結果折騰了大半天);
第二步也可以在數據庫中進行,命令如下:flush hosts;
轉載于:https://my.oschina.net/u/1036767/blog/205252
總結
以上是生活随笔為你收集整理的mysqladmin flush-hosts 解决方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 用PHP生成word文件
- 下一篇: java_Socket简单使用方法