Wednesday, July 3, 2013

MySQL persistence connection settings (Change connection Time out values)

MySQL persistence connection settings


1. Start the DB server as 'root' user with  the comandline option and check the values of 'net_read_timeout' and 'wait_timeout'



The result may be like this :

mysql> SHOW SESSION VARIABLES LIKE 'net_read_timeout';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| net_read_timeout | 30    |
+------------------+-------+
1 row in set (0.00 sec)


mysql> SHOW SESSION VARIABLES LIKE 'wait_timeout';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
wait_timeout | 30    |
+------------------+-------+
1 row in set (0.00 sec)


2. Change the values as you need

Here i am setting 28800 instead of 30


mysql> SET SESSION net_read_timeout=28800;
Query OK, 0 rows affected (0.00 sec)

mysql> SET SESSION wait_timeout=28800;
Query OK, 0 rows affected (0.00 sec)

3. Now you can check the variable values updated or not..

mysql> SHOW SESSION VARIABLES LIKE 'net_read_timeout';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
net_read_timeout | 28800 |
+------------------+-------+
1 row in set (0.00 sec)

mysql> SHOW SESSION VARIABLES LIKE 'wait_timeout';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
wait_timeout | 28800 |
+------------------+-------+
1 row in set (0.00 sec)

4. Now restart your mysql server

If you are using mysql on RedHat Linux (Fedora Core/Cent OS) then use following command:

/etc/init.d/mysqld restart

If you are using mysql on Debian / Ubuntu Linux then use following command:

/etc/init.d/mysql restart
Thats it  !

No comments:

Post a Comment

Total Pageviews

Translate