5

I have this config

mysql> SHOW VARIABLES where Variable_name like '%timeout';
+----------------------------+-------+
| Variable_name              | Value |
+----------------------------+-------+
| connect_timeout            | 5     | 
| delayed_insert_timeout     | 300   | 
| innodb_lock_wait_timeout   | 50    | 
| innodb_rollback_on_timeout | OFF   | 
| interactive_timeout        | 28800 | 
| net_read_timeout           | 30    | 
| net_write_timeout          | 60    | 
| slave_net_timeout          | 7200  | 
| table_lock_wait_timeout    | 50    | 
| wait_timeout               | 28800 | 
+----------------------------+-------+
10 rows in set (0.01 sec)

mysql>

I needs long time connect, want to unlimited timeout.

Look my php source.

<?php
$link = @mysql_connect("localhost","root",$pw);
...
mysql_query($query,$link);
...
// A long time flows (maybe 28,800sec)
mysql_query($query,$link); // error !!
?>

Please advise.

Jay
  • 397
  • 1
  • 5
  • 19
  • possible duplicate of [How can I change the default Mysql connection timeout when connecting through python?](http://stackoverflow.com/questions/14726789/how-can-i-change-the-default-mysql-connection-timeout-when-connecting-through-py) (same principle for PHP) – Tim Biegeleisen Sep 08 '15 at 06:57
  • I already know it, want to unlimited. however i read refer MYSQL. thanks – Jay Sep 08 '15 at 07:14

2 Answers2

3

The answer is NO. You can not set the wait_timeout to unlimited.

You can refer MYSQL wait_timeout

However if you want to change it then you can try like this:

SET GLOBAL connect_timeout=....;
Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331
  • But can he set the timeout to an arbitrarily large number? If so, then this question is really a duplicate. – Tim Biegeleisen Sep 08 '15 at 06:57
  • @TimBiegeleisen:- Indeed, I went with this line `want to unlimited timeout.` but that would be a different question then...isn't it? Also the present setting shows that the `wait_timeout | 28800` which is a good timeout value to have! – Rahul Tripathi Sep 08 '15 at 06:58
2

There is a limit for wait_timeout. This configuartion value can put in the configuration file my.cnf (for unix)/ my.ini (for windows).

Type    Integer
Default Value           28800;
Minimum Value           1;
Maximum Value (Other)   31536000;
Maximum Value (Windows) 2147483

Assign wait_timeout in the configuration file within the above range and restart the mysql server.

blueDexter
  • 977
  • 11
  • 14