How do I set wait_timeout to unlimited in mysql?
12 Answers
Edit
my.cnf(the MySQL configuration file).sudo vi /etc/mysql/mysql.conf.d/mysqld.cnfLocate the timeout configuration and adjust it to fit your server.
[mysqld] wait_timeout = 31536000 interactive_timeout = 31536000Save the changes and exit the editor.
Restart MySQL to apply the changes as follows:
sudo /etc/init.d/mysql restart
In my case, when I alter /etc/*/my.cnf, it would cause a lot of bugs. So I change to use mysql command to change it.
- open mysql
sudo service mysql start open command window
sudo mysql -u username -pchange the timeout
SET @@GLOBAL.interactive_timeout=31536000restart server
sudo service mysql restart
windows timeout default is 31536000, you can choose the time you like And the way to see the timeout is
show global variables like 'wait_timeout'