telnet 測試數據庫的連接超時時間
telnet 10.5.36.* 3306
1.登錄mysql數據庫
[root@iZbp11rfoyeescusr9ha9qZ conf]# mysql -u root -p
2.查詢匹配“timeout”的全局變量
MySQL [(none)]> show global variables like '%timeout%';
+----------------------------------------+--------------+
| Variable_name | Value |
+----------------------------------------+--------------+
| connect_timeout | 10 |
| delayed_insert_timeout | 300 |
| have_statement_timeout | YES |
| innodb_flush_log_at_timeout | 1 |
| innodb_lock_wait_timeout | 120 |
| innodb_rollback_on_timeout | OFF |
| interactive_timeout | 28800 |
| lock_wait_timeout | 31536000 |
| net_read_timeout | 30 |
| net_write_timeout | 60 |
| rpl_stop_slave_timeout | 31536000 |
| slave_net_timeout | 60 |
| wait_timeout | 28800 |
+-----------------------------------------+--------------+
13 rows in set (0.01 sec)
3.設置全局變量connect_timeout為12小時(12*3600=43200)
MySQL [(none)]> SET GLOBAL connect_timeout = 43200;
Query OK, 0 rows affected (0.00 sec)
4.再次查看,確認參數是否修改成功
MySQL [(none)]> show global variables like '%timeout%';
+----------------------------------------+--------------+
| Variable_name | Value |
+----------------------------------------+--------------+
| connect_timeout | 43200 |
| delayed_insert_timeout | 300 |
| have_statement_timeout | YES |
| innodb_flush_log_at_timeout | 1 |
| innodb_lock_wait_timeout | 120 |
| innodb_rollback_on_timeout | OFF |
| interactive_timeout | 28800 |
| lock_wait_timeout | 31536000 |
| net_read_timeout | 30 |
| net_write_timeout | 60 |
| rpl_stop_slave_timeout | 31536000 |
| slave_net_timeout | 60 |
| wait_timeout | 28800 |
+-----------------------------------------+--------------+
13 rows in set (0.00 sec)
5.退出數據庫
MySQL [(none)]> exit
Bye