環境:linux,10.0.38-MariaDB,
錯誤:Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'
原因:同一個ip在短時間內產生太多(超過mysql數據庫max_connection_errors的最大值)中斷的數據庫連接而導致的阻塞;
解決方法:
1.進入linux,使用命令:mysql --help |grep Distrib 查看MariaDB版本
image.png
2.查看mysql的mariaDB版本信息和路徑,使用命令:mysqladmin -u root -p version
image.png
3.登錄進入mariaDB。 使用命令:mysql -uroot -praising321654
image.png
4.查看當前最大errors數,并且修改成1000。
命令:
① 進入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%';
image.png
5.為了永久生效,最好清理一下host文件。直接使用命令:flush hosts;
image.png
通過以上步驟,最后就不會出現
Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'的提示了。