Posts Tagged ‘suggestion’

Fix MySQL connection error – Host ” is blocked because of many connection errors; unblock with ‘mysqladmin flush-hosts’

Wednesday, July 2nd, 2014

fix-mysql-too-many-connection-errors-explained

If you get a MySQL error like:

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

This most likely means your PHP / Java whatever programming language application connecting to MySQL is failing to authenticate with the application created (existing) or that the application is trying too many connections to MySQL in a rate where MySQL server can't serve all the requests.

Some common errors for Too many Connection errors are:
 

  • Networking Problem
  • Server itself could be down
  • Authentication Problems
  • Maximum Connection Errors allowed.

The value of the max_connection_errors system variable determines how many successive interrupted connection requests are permitted to myqsl server.
 

Well anyways if you get the:

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

You can consider this a sure sign application connections to MySQLis logging a lot of error connections, for some reason.
This error could also appear on very busy websites where high amount of separete connections are used – I've seen the error occur on PHP websites whether mysql_pconnect(); is selected in favour of the prooved working mysql_connect();

The first thing to do before changing / increasing default set of max connection errors is to check how many max connection errors are set within MySQL?

For that connect with MySQL CLI and issue:
 

mysql> SHOW VARIABLES LIKE '%error%';


+——————–+————————————————————-+
| Variable_name      | Value                                                           |
+——————–+————————————————————-+
| error_count        | 0                                                                     |
| log_error          | /var/log/mysql//mysqld.log                                |
| max_connect_errors | 10000                                                      |
| max_error_count    | 64                                                               |
| slave_skip_errors  | OFF                                                             |
+——————–+————————————————————-+


A very useful mysql cli command in debugging max connection errors reached problem is

mysql> SHOW PROCESSLIST;

 

To solve the error, try to tune in /etc/my.cnf, /etc/mysql/my.cnf or wherever my.cnf is located:

[mysqld]
max_connect_errors
variable

and

wait_timeout var. Some reasonable variable size would be:

max_connect_errors = 100000
wait_timeout = 60

If such (anyways) high values is still not high enough you can raise mysql config connection timeout

 

to

max_connect_errors = 100000000

Also if you want to try raise max_connect_errors var without making it permanenty (i.e. remember var setting after MySQL service restart), set it from MySQL cli with:

SET GLOBAL max_connect_errors


If you want to keep the set default max_connection_errors and fix it temporary, you can try to follow the error

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

suggestion and issue in root console:

mysqladmin flush-hosts

Same could also be done from MySQL Cli with cmd:
 

FLUSH HOSTS;

Durankulak’s beach

Monday, August 27th, 2007

In Saturday we was on a Cisco course with Nomen, Niki (A friend programmer),and the Other Niki (Mitko’s brother). The course went smoothly up to some pointafter that Niki (the programmer) has received a call with an awful news…After the course I Nomen and Nomen’s brother went to the chineese restaurant and we ate rice with vegatables and spaghetti with vegetables and meat. An hour later we was at Nomen’s home we had to make the cisco’s Chapter One and Chapter two test. And Luckily I got 100% right answers on both of the two (I have to be honest that I used cheating and tricks on the tests so I probably deserve less.After that Nomen gave suggestion to go to Carapec or somewhere on the Beach on the Bulgarian Coast. At the end we ended beaching the next morning on Durankulak’s Camping beach after we setupped a fire for the night and we slept in tents. There was a lot of problems during the whole trip ( I won’t go into details) but Thanks to God Almighty all has ended well in the end. Talking about God, I’m smoking cigarettes again and I have to stop (I hope God would help again). Also something I have to note is I’m a sinner but God is faithful although I sin badly The Lord is gracious to me still. PRAISE THE LORD!!! HalleluJah! :]END—–

Alternative way to kill X in Linux with Alt + Printscreen + K

Sunday, October 31st, 2010

I’ve recently realized that the CTRL + ALT + BACKSPACE keyboard combination is no longer working in Debian unstable.

This good old well known keyboard combination to restart X is not working with my xorg 7.5+8 under my Gnome 2.30 desktop
However thanksfully there is another combination to kill the X server if for instance if your Gnome desktop hangs.

If that happens simply press ALT + PRINTSCREEN + K this will kill your X and then reload the (Gnome Display manager) gdm.

Another suggestion I’ve red in the forums of a way to enable back CTRL+ALT+BACKSPACE is to put in either .bashrc or .xinitrc the following command

setxkbmap -option terminate:ctrl_alt_bksp

BTW It’s better that the above command is placed in ~/.xinitrc.

I’ve also red on some forums that in newer releases of Ubuntu. The CTRL+ALT+BACKSPACE can be enabled using a specific command, e.g. with:

dontzap -disable