mysql连接异常

java.lang.RuntimeException: java.sql.SQLException: null,  message from server: "Host '10.194.3.21' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'"
    at org.nutz.lang.Lang.wrapThrow(Lang.java:187) ~[app.jar:?]
    at org.nutz.dao.jdbc.Jdbcs.getExpert(Jdbcs.java:116) ~[app.jar:?]
    at org.nutz.dao.impl.DaoSupport.setDataSource(DaoSupport.java:187) ~[app.jar:?]
    at org.nutz.dao.impl.DaoSupport.setDataSource(DaoSupport.java:178) ~[app.jar:?]
    at org.nutz.dao.impl.NutDao.(NutDao.java:108) ~[app.jar:?]

错误:

Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'

原因:

同一个ip在短时间内产生太多(超过mysql数据库max_connection_errors的最大值)中断的数据库连接而导致的阻塞;

解决方案:
执行如下命令

flush hosts;
set global max_connect_errors = 1000;
show variables like 'max_connect_errors';

你可能感兴趣的:(mysql连接异常)