Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
67
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

MySQL の wait_timeout を変更。

接続維持時間をデフォルトの 8 時間から 1 分に変更。
この設定、接続のアイドル状態が一定時間続くと MySQL 側から自動的に接続を切る設定らしい。

うかつに低く設定すると、バッチ処理とかのときに考慮が必要になりそう。

稼働中のサーバで変更。

> set global wait_timeout=60;
> show global variables like '%wait%';
+---------------------------------------------------+----------+
| Variable_name                                     | Value    |
+---------------------------------------------------+----------+
| innodb_lock_wait_timeout                          | 120      |
| innodb_spin_wait_delay                            | 6        |
| lock_wait_timeout                                 | 31536000 |
| performance_schema_events_waits_history_long_size | 10000    |
| performance_schema_events_waits_history_size      | 10       |
| wait_timeout                                      | 60       |
+---------------------------------------------------+----------+
6 rows in set (0.00 sec)

my.cnf に書く場合こんな感じ。

[mysqld]
wait_timeout = 60
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
67
Help us understand the problem. What are the problem?