title: MySQL "wait_timeout" not being honored for long query?
body: <p>I'm trying to test the <code>wait_timeout</code> MySQL setting which seems to be ignored.</p>
  
  <p><strong>PHP script:</strong></p>
  
  <pre><code>&lt;?php
  function microtime_float()
  {
      list($usec, $sec) = explode(" ", microtime());
      return ((float)$usec + (float)$sec);
  }
  
  $sql = mysqli_connect('localhost','root','root','mysql');
  $query = "SHOW VARIABLES WHERE Variable_name='wait_timeout';";
  $result = $sql-&gt;query($query) or die($query.'&lt;br /&gt;'.$sql-&gt;error);
  $row = $result-&gt;fetch_object();
  echo "wait_timeout = " . $row-&gt;Value . "&lt;br/&gt;\n";
  
  $time_start = microtime_float();
  $query = "SELECT SLEEP(2) FROM mysql.user;";
  $sql-&gt;query($query) or die($query.'&lt;br /&gt;'.$sql-&gt;error);
  $time_end = microtime_float();
  $time = $time_end - $time_start;
  echo "Query completed in $time seconds&lt;br/&gt;\n";
  echo "You got the page";
  </code></pre>
  
  <p><strong>Script output:</strong></p>
  
  <pre><code>wait_timeout = 2
  Query completed in 8.0005459785461 seconds
  You got the page
  </code></pre>
  
  <p><strong>My configuration</strong></p>
  
  <pre><code>mariadb-server-5.3.5
  php5.3.6
  </code></pre>
  
  <p><strong>What do I need to do in order to force MySQL to time out queries after a certain amount of time?</strong></p>