LoginSignup
19
18

More than 5 years have passed since last update.

mysqlでblocked because of many connection errors発生

Last updated at Posted at 2016-12-07

mysqlで接続エラーが発生していたので、忘れないようにメモ。

エラー

mysqlで下記のようなエラーが発生。

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

原因

しきい値を超えて、連続で接続に失敗すると発生する模様。

しきい値はmax_connect_errorsの値で、デフォルト値は100(MySQL 5.6.6より前は10)。
↓で値を確認。

SELECT @@global.max_connect_errors;

公式のリファレンスを見ると、下記のように書いてある。

max_connect_errors システム変数の値は、連続して接続要求が中断された場合にそれを許可する回数を決定します。
(セクション5.1.4「サーバーシステム変数」を参照してください。)接続が成功せずに max_connect_errors 回要求が失敗すると、
mysqld は何らかの問題があると見なし (たとえば、何者かが侵入しようとしている)、
FLUSH HOSTS ステートメントを発行するか、mysqladmin flush-hosts コマンドを実行するまで、そのホストが接続できないようにします。

攻撃を受けていると判断される模様。

対応

コネクション数をflushする。

FLUSH HOSTS;

max_connect_errorsの値を変更

SET GLOBAL max_connect_errors=300;
19
18
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
19
18