报错内容:
java.sql.SQLException: null, message from server: "Host '10.21.5.91' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'"
报错引起原因分析
- 同一个ip在短时间内产生太多中断的数据库连接而导致的阻塞
- 数据库多次错误连接,造成屏蔽了当前ip连接数据库的请求
- 超过了mysql数据库max_connection_errors的最大值
解决方式1:
选中数据库----刷新----权限
解决方式2:
重启mysql
/etc/init.d/mysqld restart
or
/etc/init.d/mysqld restart
解决方式3:
1、可以使用mysqladmin flush-hosts 命令清理一下hosts文件;
mysqladmin flush-hosts -h iphost -P port -u root -prootpasswd;
2、或者试试下面的方法
1.提高max_connection_errors数量:
(1)修改max_connection_errors的数量为1000:
set global max_connect_errors=1000;
(2) 查看是否修改成功:
SHOW GLOBAL VARIABLES LIKE '%max_connect_errors%';
参考:https://blog.csdn.net/weixin_45126177/article/details/119395463
https://blog.csdn.net/qq_40965479/article/details/105833415
https://segmentfault.com/a/1190000040256955