Mysql modification connection timeout in Linux _ MySQL

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.