Bug #13518 'mysqladmin variables' and 'show variables' disagree on wait_timeout value
Submitted: 27 Sep 2005 9:30 Modified: 27 Sep 2005 14:23
Reporter: Struan Bartlett Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:Ver 14.7 Distrib 4.1.11 OS:Linux (Debian)
Assigned to: CPU Architecture:Any

[27 Sep 2005 9:30] Struan Bartlett
Description:
'mysqladmin variables' and 'show variables' disagree on wait_timeout value.

How to repeat:
# grep wait_timeout /etc/mysql/my.cnf
set-variable    = wait_timeout=3600

mysql> show variables like '%wait_timeout%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| innodb_lock_wait_timeout | 50    |
| wait_timeout             | 28800 |
+--------------------------+-------+
2 rows in set (0.00 sec)

# mysqladmin variables -uroot -pc0J0n35 | grep wait_timeout
| innodb_lock_wait_timeout        | 50         |
| wait_timeout                    | 3600         |
[27 Sep 2005 9:32] Struan Bartlett
Problem equally reproducible on Debian Sarge/Linux 2.6.13 SMP and Debian Woody/Linux 2.4.29 SMP.
[27 Sep 2005 10:52] Valeriy Kravchuk
Are you sure you are getting these results (in mysql client and with mysqladmin) from the same mysqld? Please, start mysqld explicitely with explicit with_timeout value and send the complete log of all the actions with the outputs.

I was not able to repeat this behaviour on 4.1.14-nt: in both cases the default 28800 value is shown.
[27 Sep 2005 11:25] Struan Bartlett
As you will see, this problem is reproducible on Debian Woody Linux 2.4.24 running MySQL v4.1.9 too.

# mysqld --wait_timeout=10
050927 12:22:30  InnoDB: Started; log sequence number 0 43654
mysqld: ready for connections.
Version: '4.1.9-Debian_2-log'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  Source distribution

# mysqladmin variables -pxxxxxxxx | grep wait_timeout
| innodb_lock_wait_timeout        | 50           |
| wait_timeout                    | 10           |

# mysql -pxxxxxxx
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.1.9-Debian_2-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show variables like '%wait_timeout%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| innodb_lock_wait_timeout | 50    |
| wait_timeout             | 28800 |
+--------------------------+-------+
2 rows in set (0.00 sec)
[27 Sep 2005 11:34] Struan Bartlett
I've also now reproduced this on v4.1.11, with the command-line --wait_timeout option. All command below are executed on the same machine:

# mysqld --wait_timeout=15
050927 12:28:46 [Warning] Can't open and lock time zone table: Table 'mysql.time_zone_leap_second' doesn't exist trying to live without them
mysqld: ready for connections.
Version: '4.1.11-Debian_4-log'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  Source distribution

# mysqladmin variables -uroot -pxxxxxxx | grep wait_timeout
| innodb_lock_wait_timeout        | 50         |
| wait_timeout                    | 15         |

# mysql -hlocalhost -uroot -pxxxxxxxx
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.1.11-Debian_4-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show variables like '%wait_timeout%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| innodb_lock_wait_timeout | 50    |
| wait_timeout             | 28800 |
+--------------------------+-------+
2 rows in set (0.00 sec)
[27 Sep 2005 14:23] Hartmut Holzgraefe
"mysqladmin variables" is equivalent to "SHOW GLOABL VARIABLES", not to "SHOW VARIABLES" which is the same as "SHOW SESSION VARIABLES"

the actual session value is set to the global wait-timeout for regular sessions but to interactive-timeout for interactive client sessions. as the mysql command line client is an interactive client you'll see the global interactive-timeout value in the sessions wait-timeout variable, not the global wait-timeout 

see also the last item on http://dev.mysql.com/doc/mysql/en/server-system-variables.html 

     *  wait_timeout

        The number of seconds the server waits for activity on a non-interactive 
        connection before closing it.

        On thread startup, the session wait_timeout value is initialized from the
        global wait_timeout value or from the global interactive_timeout value, 
        depending on the type of client (as defined by the CLIENT_INTERACTIVE 
        connect option to mysql_real_connect()). See also interactive_timeout.