You can enable MySQL to decrease the how long a sleeping connection can remain open
1.Log into your server and make sure your MySQL instance is running.
2.Locate MySQL configuration file. On a Linux OS you would normally find it at "/etc/my.cnf".
3.Open your MySQL configuration file with any text editor, and add the following lines under "[mysqld]"
# Reduced wait_timeout to stop idle connections.
4.You can change the amount of time measured in seconds.
5.When you are done, save the file and then restart MySQL.