# MySQL 5.1.36 on FreeBSD 7.2 amd64/i386 not honoring wait_timeout



## cruel_symbol (Aug 6, 2009)

I installed mysql51-server from the ports.


```
# cd /usr/ports/databases/mysql51-server
# make -D BUILD_OPTIMIZED install clean
```

Added wait_timeout = 60 to my.cnf and restarted mysql but this is not reflected.


```
mysql> SHOW VARIABLES LIKE 'wait_%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout | 28800  |
+---------------+-------+
1 row in set (0.01 sec)
```


Then I tried setting it from mysql shell


```
mysql> set global wait_timeout = 30;
mysql> SHOW VARIABLES LIKE 'wait_%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout | 28800  |
+---------------+-------+
1 row in set (0.01 sec)
```

MySQL 5.1 notes for FreeBSD says that this problem when using LinuxThreads and should be solved by FreeBSD 5.0. I'm using FreeBSD 7.2 and no LinuxThreads.

Any idea how to get past this.

Thanks


----------



## dennylin93 (Aug 7, 2009)

I just tried this as well, and it worked for me. I'm using mysql-server-5.1.36 on 7.1-RELEASE-p6 (amd64).

I didn't use BUILD_OPTIMIZED, but I don't think this is why your settings aren't honoured.

I added

```
wait_timeout = 60
```
to the [mysqld] section of /usr/local/etc/my.cnf and ran `# /usr/local/etc/rc.d/mysql-server restart`.

The result was checked with phpMyAdmin.


----------



## brd@ (Aug 9, 2009)

Make sure it is under the right section in the my.cnf file as dennylin93 mentions. Otherwise try a clean reinstall without the 
	
	



```
-D BUILD_OPTIMIZED
```
 bits and see if that works better.


----------



## cruel_symbol (Aug 11, 2009)

i'v tried that but it still doesnt reflect that


```
grep -C 2 ^wait_timeout /var/db/mysql/my.cnf
# The MySQL server
[mysqld]
wait_timeout = 60
port            = 3306
socket          = /tmp/mysql.sock

mysql> show variables like '%timeout%';
+----------------------------+-------+
| Variable_name              | Value |
+----------------------------+-------+
| connect_timeout            | 10    | 
| 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          | 3600  | 
| table_lock_wait_timeout    | 50    | 
| wait_timeout               | 28800 | 
+----------------------------+-------+
10 rows in set (0.00 sec)
```


Since its a production machine i wont be able to recompile it without BUILD_OPTIMIZED. I'll have to try it on a VM when I get my hands on one.


----------



## unixeagle (Sep 5, 2009)

No need to recompile. The build options has nothing to do with your problem.

When you check "wait_timeout" value from mysql shell you are actually getting the "interactive_timeout" value, as mysql shell is considered as an interactive client. You can set the "interactive_timeout" to a specific value in my.cnf and see for your self.
You can also check the value of "wait_timeout" with "SHOW GLOBAL VARIABLES LIKE '%timeout%';"

Do not recompile.


----------



## cruel_symbol (Sep 10, 2009)

Thanks for the info. 
Now i can sleep better


----------



## sikandar (Oct 15, 2009)

*MYSQL Wait_timeout problem*

1) Added the line "wait_timeout=900" in my.ini.
2) Added the line "interactive-timeout=900" in my.ini.


----------



## ipsure (Jul 14, 2010)

Thanks unixeagle,

Adding "interactive_timeout = 60" along with "wait_timeout = 60" into my.cnf makes them both reflected to the output of "mysql> show variables;" shell command.


----------

