MySQL, wait_timeout, Mac OS X Mountain Lion - how do i set it? I need to change the wait_timeout for my MySQL database, but when I set this parameter in the my.cnf class (either in /etc or in /private/etc, because one of them is a link to the other), I still get the same default value when I type show variables in MySQL.

How do I change that value on Mac OS X then?

UPDATE
I tried setting the value using mysql console, but it didn't help:

mysql> set global wait_timeout = 333;
Query OK, 0 rows affected (0.00 sec)

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    |
| lock_wait_timeout          | 31536000 |
| net_read_timeout           | 30       |
| net_write_timeout          | 60       |
| slave_net_timeout          | 3600     |
| wait_timeout               | 28800    |
+----------------------------+----------+
10 rows in set (0.00 sec)

It did work without the word "global", though, but that affects only the current connection.
I believe you're running into a few different problems:

1) For interactive clients like the mysql client program (and not for most web applications), session wait_timeout is initialised from interactive_timeout when your client connects, so changing the global wait_timeout has no effect on the effective wait_timeout for your mysql client. This is covered in the MySQL documentation here:


  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.


2) You're changing a global setting (set global ...) and then looking at session variables ('show variables' instead of 'show global variables')

3) Session variables are only reinitialised from global variables when you reconnect

For the solution, the following should set the effective wait_timeout for your mysql client to 333:

set global wait_timeout=333
set global interactive_timeout=333


Then disconnect.

To persist the changes across restarts, you can add the following to the [mysqld] section of my.cnf:

wait_timeout=333
interactive_timeout=333


If the reason you're making these changes is because of a problem a client that doesn't set CLIENT_INTERACTIVE is having, then you can disregard interactive_timeout.

Before making changes, I recommend reviewing this blog post and the MySQL documentation to ensure you understand how these settings function and the impact of changing them.