1

How do I set wait_timeout to unlimited in mysql?

  • You can not set the wait_timeout to unlimited. – Rinzwind Mar 14 '17 at 15:51
1
  1. Edit my.cnf (the MySQL configuration file).

    sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
    
  2. Locate the timeout configuration and adjust it to fit your server.

    [mysqld]
    wait_timeout = 31536000
    interactive_timeout = 31536000
    
  3. Save the changes and exit the editor.

  4. Restart MySQL to apply the changes as follows:

    sudo /etc/init.d/mysql restart
    
  • That is setting it to the max allowed value (in seconds). High, yes. But not unlimited. – Rinzwind Mar 14 '17 at 15:53
0

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.

  1. open mysql sudo service mysql start
  2. open command window

    sudo mysql -u username -p 
    
  3. change the timeout

    SET @@GLOBAL.interactive_timeout=31536000
    
  4. restart 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'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.