<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.hostek.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Edwardf</id>
		<title>Hostek.com Wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.hostek.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Edwardf"/>
		<link rel="alternate" type="text/html" href="https://wiki.hostek.com/Special:Contributions/Edwardf"/>
		<updated>2026-04-15T06:35:36Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.24.2</generator>

	<entry>
		<id>https://wiki.hostek.com/index.php?title=Change-the-MySQL-Timeout-on-a-Server&amp;diff=2920</id>
		<title>Change-the-MySQL-Timeout-on-a-Server</title>
		<link rel="alternate" type="text/html" href="https://wiki.hostek.com/index.php?title=Change-the-MySQL-Timeout-on-a-Server&amp;diff=2920"/>
				<updated>2016-11-28T05:34:23Z</updated>
		
		<summary type="html">&lt;p&gt;Edwardf: Created page with &amp;quot;MySQL server timeout can occur for many reasons, but happens most often when a command is sent to MySQL over a closed connection. The connection could have been closed by the...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;MySQL server timeout can occur for many reasons, but happens most often when a command is sent to MySQL over a closed connection. The connection could have been closed by the MySQL server because of an idle-timeout; however, in most cases it is caused by either an application bug, a network timeout issue (on a firewall, router, etc.), or due to the MySQL server restarting. Rarely does the wait_timeout value cause the problem, and changing the value does not fix the problem. For cases where an application fails to close a connection it is no longer using, a low wait_timeout value can help to avoid hitting max_connections simply due to “sleeping” idle connections that are not in a transaction and will not be reused.&lt;br /&gt;
&lt;br /&gt;
Follow these steps to resolve the issue:&lt;br /&gt;
&lt;br /&gt;
1. Log in to your server using SSH.&lt;br /&gt;
&lt;br /&gt;
2. Edit my.cnf (the MySQL configuration file).&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;sudo vi /etc/my.cnf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Locate the timeout configuration and adjust it to fit your server.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;wait_timeout = 28800&lt;br /&gt;
interactive_timeout = 28800&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* The interactive timeout does not affect any web application connections. A high interactive_timeout but a low wait_timeout is normal and is the best practice.&lt;br /&gt;
&lt;br /&gt;
:* Choose a reasonable wait_timeout value. Stateless PHP environments do well with a 60 second timeout or less. Stateful applications that use a connection pool (Java, .NET, etc.) will need to adjust wait_timeout to match their connection pool settings. The default 8 hours (wait_timeout = 28800) works well with properly configured connection pools.&lt;br /&gt;
&lt;br /&gt;
:* Configure the wait_timeout to be slightly longer than the application connection pool’s expected connection lifetime. This is a good safety check.&lt;br /&gt;
&lt;br /&gt;
:* Consider changing the wait_timeout value online. This does not require a MySQL restart, and the wait_timeout can be adjusted in the running server without incurring downtime. You would issue set global wait_timeout=60 and any new sessions created would inherit this value. Be sure to preserve the setting in my.cnf. Any existing connections will need to hit the old value of wait_timeout if the application abandoned the connection. If you do have reporting jobs that will do longer local processing while in a transaction, you might consider having such jobs issue set session wait_timeout=3600 upon connecting.&lt;br /&gt;
&lt;br /&gt;
4. Save the changes and exit the editor.&lt;br /&gt;
&lt;br /&gt;
5. Restart MySQL to apply the changes as follows:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;sudo /etc/init.d/mysql restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the restart completes, the new changes are applied.&lt;/div&gt;</summary>
		<author><name>Edwardf</name></author>	</entry>

	</feed>