title: Mysql2: close client connection
body: <p>I am using <code>Mysql2</code> to query a database on <code>ruby</code>. I initialize the connection by:</p>
  
  <pre><code>client = Mysql2::Client.new(:host =&gt; "localhost", :database =&gt; 'mydb', :username =&gt; "root")
  </code></pre>
  
  <p>Once the query is done successfully, how can I close the client connection? If I do not close it, I soon reach the maximum number of possible open connections.</p>
  
  <h3>Solution</h3>
  
  <p>Thanks to @joonty:</p>
  
  <p><code>client.close</code></p>