错误:Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'
原因:
同一个ip在短时间内产生太多(超过mysql数据库max_connection_errors的最大值)中断的数据库连接而导致的阻塞;
解决方法:
1、提高允许的max_connection_errors数量(治标不治本):
1 进入Mysql数据库查看max_connection_errors:
show variables like '%max_connection_errors%';
2 修改max_connection_errors的数量为1000: set global max_connect_errors = 1000;
3 查看是否修改成功:
show variables like '%max_connection_errors%';
4 再运行命令
flush hosts;
运行成功后若客户端仍然报错
错误:java.sql.SQLException: java.lang.OutOfMemoryError: Java heap space
则在url后面添加
&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true
示例:
url: jdbc:mysql://192.168.0.116:3306/thzk_weighing_db?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true