MySQL performance parameters detailed Max_connect_errors usage introduction

  • 2020-12-26 05:55:21
  • OfStack

max_connect_errors is a security-related counter value in MySQL that is responsible for preventing too many clients from trying to fail in order to prevent violent password cracking. The value of max_connect_errors has little to do with performance.

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

Parameter format

max_connect_errors = 10

Change the method
If the system is CentOS, Debian, etc., then the configuration file may be located at /etc/ my.cnf. Open this file

[root@www ~]# vi /etc/my.cnf
You can then add the above statements in the [mysqld] configuration section.

Configuration instructions
When this value is set to 10, it means that if a 1 client tries to connect to this MySQL server, but fails (such as password error, etc.) 10 times, MySQL will unconditionally force this client to block the connection.

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

Mysql > FLUSH HOSTS;
Command.

When this 1 client successfully connects to the MySQL server once, max_connect_errors for this client will be cleared.

Influence and error form

If the setting of max_connect_errors is too small, the page may indicate that the database server cannot be connected. A connection to the database via SSH's mysql command returns

ERROR 1129 (00000): Host 'gateway' is because because many connection errors unblock with 'mysqladmin flush - hosts'

Error.

Function and function

Generally speaking, it is recommended that the database server should not listen to the connection from the network, but only use THE CONNECTION from sock, which can prevent most attacks against mysql. If you must turn on mysql's network connection, it is a good idea to set this value to prevent exhaustive password attacks.

This site this site prompts:

If your mysql is often used for violent decrypting, do not use it in general. The number of Settings will cause mysql to stop working.

Below is the 6000 set for 16G memory machine, you can refer to 1.

max_connect_errors = 6000
# Set the maximum number of connection requests per host for exception interrupts, after which the MYSQL server disables the connection requests from host until the mysql server restarts or clears the host information via the flush hosts command.


Related articles: