title: How do I select a MySQL database to use with PDO in PHP?
body: <p>I want to select a MySQL database to use after a PHP PDO object has already been created.  How do I do this?</p>
  
  <pre><code>// create PDO object and connect to MySQL
  $dbh = new PDO( 'mysql:host=localhost;', 'name', 'pass' );
  
  // create a database named 'database_name'
  
  // select the database we just created ( this does not work )
  $dbh-&gt;select_db( 'database_name' );
  </code></pre>
  
  <p>Is there a PDO equivalent to mysqli::select_db?</p>
  
  <p>Perhaps I'm trying to use PDO improperly?  Please help or explain.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Should I not be using PDO to create new databases?  I understand that the majority of benefits from using PDO are lost on a rarely used operation that does not insert data like <code>CREATE DATABASE</code>, but it seems strange to have to use a different connection to create the database, then create a PDO connection to make other calls.</p>