Mariadb error - Host is blocked because of many connection errors

  • Last updated: Nov 3, 2023
  • Views: 904
  • Author: Admin
Mariadb error - Host is blocked because of many connection errors

Colleagues hello to all.

In today's article, we will talk about a very common error in Mariadb called - "Host is blocked because of many connection errors".

This error means that the Mariadb database has received a lot of aborted requests from the client, and the number of these errors has been overridden by the max_connect_errors system variable. The default value of the  max_connect_errors variable is 100.

To make sure of this, let's use queries:

mariadb> SHOW VARIABLES LIKE 'max_connect_errors';

host_is_blocked

 

To solve this problem, we need to change the values ​​of max_connect_errors to, for example, 10,000. The variable is dynamic, so we can use the SET GLOBAL command.

mariadb> SET GLOBAL max_connect_errors = 10000;

host_is_blocked

 

And of course, add this variable to the server.cnf configuration file.

$. vim /etc/my.cnf.d/server.cnf

host_is_blocked

 

After all that we have done, we just need to clear the cache of the table that is responsible for storing hosts. The table that is responsible for storing hosts is stored in the performance_schema and the table is called host_cache. There are two ways to clean up.

The first way to do this is to execute the delete command:

mariadb> DELETE FROM performance_schema.host_cache;

The second way is easier to use the command:

mariadb> FLUSH HOSTS;


 

Thank you all, I hope that my article helped you in some way.

SIMILAR ARTICLES

How to move the MariaDB data directory

How to move the MariaDB data directory

MariaDB - database backup - mysqldump

MariaDB - database backup - mysqldump

How to extend the MariaDB config file, includedir - include

How to extend the MariaDB config file, includedir - include