title: Error, too many connections to mysql using PDO showed our db username and password?
body: <p>At some point earlier on it appears there were too many sql connections and the following was echo'd to screen for whomever was looking:</p>
  
  <pre><code>PHP Fatal error:  Uncaught exception 'PDOException' with message  'SQLSTATE[08004] [1040] Too many connections' in /dir/file.php:21
  Stack trace:
  #0 /dir/file.php(21): PDO-&gt;__construct('mysql:host=loca...', 'the user', 'password')
  </code></pre>
  
  <p>As you can see, it printed the username and password.</p>
  
  <p>I'm new to PDO form of connecting to db, and I got into it because people told me my regular mysql_connect form was insecure. However by default, when mysql_connect ever had too any connections it <strong>never</strong> printed the username and password to the screen.</p>
  
  <p>What a disaster.</p>
  
  <p>How do I stop PDO from doing this if it error's out??</p>
  
  <p>I'm using:</p>
  
  <pre><code>$dbh = new PDO('mysql:host=localhost;dbname=' . $db, $user, $pass);
  </code></pre>