I'm running MySQL on a remote server, and it suddenly started rejecting all connections:

$ mysql -h -u root -p
ERROR 1129 (00000): Host 'web' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'

So, I try this flush-hosts command...

$ mysqladmin flush-hosts -h -u root -p
mysqladmin: connect to server at '' failed
error: 'Host 'web' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts''

I.e. it's blocking the very un-blocking tool it recommends. Am I doing it wrong, or will I have to resort to ssh/cpanel/physical access?


To start with you really need to determine who and why is making that many connections so you need to connect with ssh anyways to check all the relevant logs (probably in /var/log/mysql/error.log)

If the connections are legitimate you probably need to either increase the max_connections directive in /etc/my.cnf or see if you might be able to improve the SQL queries send to the server so that not that many connections are left open.

If they are not legitimate you need to harden security for certain.

Since you will be already logged with ssh to check the logs flash the connections from localhost.

  • Your point is valid, but changing max_connections won't help - this is ERROR 1129 (too many connection errors), not ERROR 1203 or ERROR 1040 (too many connections). Thanks regardless. – aidan Apr 4 '13 at 6:20
  • Misread the error msg and placed the s after 'connection' instead after 'error'. Well it seems someone is trying to connect from your host using erroneous credentials or doing the original handshake and not completing the login which is also considered an error. I think the default is that after 10 attempts the host is blocked but you need to check 'show variables' to make sure. Checking the logs still stands to determine what is going on. Also restart the mysql instance to clear everything. – thanosk Apr 4 '13 at 6:40
  • The fault turned out to be hardware failure, but really my question was this: why does MySQL recommend a solution that, by definition, can't work? – aidan Apr 5 '13 at 0:14
  • It would work, just not from the same host... – etagenklo Apr 7 '13 at 16:35
  • @aidan MySQL is saying what it knows based on the fact it’s simply software that is reporting what it sees. And if the max connections is maxed out it will say as much. Ever see an Apache server under DDoS attack? The logs say that I should consider increasing connections. But guess what? A human being can see what is happening & deduce; this thing is out of control. – JakeGould Nov 9 '13 at 1:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.