---
title: "MySQL出现 *.*.*.* blocked because of many connection errors解决办法"
author: "xiaojiit"
date: "2012-06-29T11:36:33Z"
tags: []
categories: ["数据库"]
slug: "mysql-blocked-because-of-many-connection-errors"
draft: false
lastmod: "2012-06-29T11:36:33Z"
id: 1570832
url: "https://sharejava.iteye.com/blog/1570832"
---

在使用客户端连接MySQL时，会遇到这个错误：

 

 

MySQLDriverCS Exception: MySQLDriverCS Error: can't connect.Host '172.16.1.254' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'

 

可以通过，执行命令 mysqladmin flush-hosts 可以解决

 

原因:   
mysql中默认的max\_connect\_errors是10，由于连接出错，造成这个数值高于10，当在访问的时候就被锁住了, 并屏蔽主机的进一步连接请求。

 

my.cnf 中没有此行，需要添加如下：

 

 

 

max\_connect\_errors = 10