Mysql modification connection timeout in Linux bitsCN.com
Connection modification timeout for mysql in Linux
1. First, go to mysql and check whether the value wait_timeout and interactive_timeout are the default 8 hours (that is, 28800)
[Root @ server110 ~] # Mysql-u root-p
Enter password:
Enter the password
Run the following command:
Show variables like '% timeout % ';
+ ---------------------------- + ------- +
| Variable_name | Value |
+ ---------------------------- + ------- +
| Connect_timeout | 10 |
| Delayed_insert_timeout | 300 |
| Innodb_lock_wait_timeout | 50 |
| Innodb_rollback_on_timeout | OFF |
| Interactive_timeout | 28800 |
| Net_read_timeout | 30 |
| Net_write_timeout | 60 |
| Slave_net_timeout | 3600 |
| Table_lock_wait_timeout | 50 |
| Wait_timeout | 28800 |
+ ---------------------------- + ------- +
As shown in the following table, the default connection timeout is 8 hours.
Modified
2. in mysql 5 or later versions, you need to modify the file my. cnf. the file is located
/Etc/my. cnf
Add the following two sentences after [mysqld ]:
Wait_timeout = 388000
Interactive_timeout = 388000
3. restart mysql
Service mysqld restart
The following content is displayed:
Stop MySQL: [OK]
Start MySQL: [OK]
Now you can use the 1 method to view the values of these two parameters.
+ ---------------------------- + -------- +
| Variable_name | Value |
+ ---------------------------- + -------- +
| Connect_timeout | 10 |
| Delayed_insert_timeout | 300 |
| Innodb_lock_wait_timeout | 50 |
| Innodb_rollback_on_timeout | OFF |
| Interactive_timeout | 388000 |
| Net_read_timeout | 30 |
| Net_write_timeout | 60 |
| Slave_net_timeout | 3600 |
| Table_lock_wait_timeout | 50 |
| Wait_timeout | 388000 |
+ ---------------------------- + -------- +
OK. modified.
BitsCN.com