MySql Host is blocked because of many connection E

Source: Internet
Author: User
Tags mysql host

Environment:linux,mysql5.5.21

Error: Host is blocked because of many connection errors; Unblock with ' mysqladmin flush-hosts '

Reason:

Congestion caused by the same IP in a short period of time resulting in too many (exceeding the maximum value of MySQL database max_connection_errors) interrupted database connections;

Workaround:

1, increase the allowable number of max_connection_errors (Temporary Cure):

① into MySQL database view Max_connection_errors:  Show Variables like '%max_connection_errors% ';

   ② Modify the number of max_connection_errors for 1000:  Set Global max_connect_errors = +;

③ See if the modification succeeded: show variables like '%max_connection_ errors% ';

2, use mysqladmin flush-hosts command to clean up the Hosts file (do not know mysqladmin in which directory can use command lookup:whereis mysqladmin);

① in the found directory using the command to modify:/usr/bin/mysqladmin flush-hosts-h192.168.1.1 -p3308 -uroot-prootpwd;

Note:

Where the port number, user name, password can be added and modified as needed;

Configuration has master/slave master and slave database to the main library and from the library are modified again (I ate this loss obviously very easy several command results toss the most days);

The second step can also be done in the database, the command is as follows:flush hosts;



Max_connect_errors–mysql Performance Parameters Detailed

Max_connect_errors is a security-related counter value in MySQL that is responsible for blocking excessive attempts by clients that fail to prevent brute-force password violations. The value of max_connect_errors is not much related to performance.

By default, there may not be this line in the My.cnf file, and if you need to set this number, you can add it manually.

Parameter format

1

Max_connect_errors = 10

Modify method

If the system is CentOS, Debian, etc., the configuration file may be located in/etc/my.cnf. Open this file

1

[Root@www ~]# vi/etc/my.cnf

Then add the above statement in the [mysqld] configuration section.

Configuration Instructions

When this value is set to 10 o'clock, it means that if a client attempts to connect to this MySQL server but fails (such as a password error, and so on) 10 times, MySQL will unconditionally force this client connection to be blocked.

If you want to reset the value of this counter, you must restart the MySQL server or perform

1

Mysql> FLUSH HOSTS;

Command.

When this client successfully connects to a MySQL server, the max_connect_errors for this client are zeroed out.

Impact and wrong form

If the setting of the max_connect_errors is too small, the Web page may prompt that the database server cannot be connected, and the MySQL command to SSH to the database will return

ERROR 1129 (00000): Host ' Gateway ' is blocked because of many connection errors; Unblock with ' mysqladmin flush-hosts '

Error.

Functions and Roles

In general, it is recommended that the database server does not listen for connections from the network, only through sock connections, which prevents most attacks against MySQL, and if it is necessary to turn on MySQL's network connection, it is best to set this value to prevent brute-code attacks.




MySql Host is blocked because of many connection E

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.