Section 1. Посмотреть все текущие лимиты можно командой:
show variables like '%timeout%';
Вывод будет примерно такой:
mysql> show variables like '%timeout%'; +-----------------------------+----------+ | Variable_name | Value | +-----------------------------+----------+ | connect_timeout | 360 | | delayed_insert_timeout | 300 | | have_statement_timeout | YES | | innodb_flush_log_at_timeout | 1 | | innodb_lock_wait_timeout | 50 | | innodb_rollback_on_timeout | OFF | | interactive_timeout | 28800 | | lock_wait_timeout | 31536000 | | net_read_timeout | 300 | | net_write_timeout | 60 | | rpl_stop_slave_timeout | 31536000 | | slave_net_timeout | 3600 | | thread_pool_idle_timeout | 60 | | wait_timeout | 28800 | +-----------------------------+----------+ 14 rows in set (0.01 sec)
Section 2. 1. Start the DB server as ‘root’ user with the comandline option and check the values of ‘net_read_timeout’ and ‘wait_timeout’
The result may be like this :
mysql> SHOW SESSION VARIABLES LIKE ‘net_read_timeout’;
+——————+——-+
| Variable_name | Value |
+——————+——-+
| net_read_timeout | 30 |
+——————+——-+
1 row in set (0.00 sec)
mysql> SHOW SESSION VARIABLES LIKE ‘wait_timeout’;
+——————+——-+
| Variable_name | Value |
+——————+——-+
| wait_timeout | 30 |
+——————+——-+
1 row in set (0.00 sec)
Section 3. 2. Change the values as you need
1) Here i am setting 28800 instead of 30
mysql> SET SESSION net_read_timeout=28800;
Query OK, 0 rows affected (0.00 sec)
mysql> SET SESSION wait_timeout=28800;
Query OK, 0 rows affected (0.00 sec)
Section 4. 3. Now you can check the variable values updated or not..
mysql> SHOW SESSION VARIABLES LIKE ‘net_read_timeout’;
+——————+——-+
| Variable_name | Value |
+——————+——-+
| net_read_timeout | 28800 |
+——————+——-+
1 row in set (0.00 sec)
mysql> SHOW SESSION VARIABLES LIKE ‘wait_timeout’;
+——————+——-+
| Variable_name | Value |
+——————+——-+
| wait_timeout | 28800 |
+——————+——-+
1 row in set (0.00 sec)
SET GLOBAL connect_timeout=60;
Section 5. 4. Now restart your mysql server
1) If you are using mysql on RedHat Linux (Fedora Core/Cent OS) then use following command:
/etc/init.d/mysqld restart
2) If you are using mysql on Debian / Ubuntu Linux then use following command:
/etc/init.d/mysql restart
Thats it !