title: How to connect to sql database through php/pdo that has been exported from mysql/phpmyadmin as mydatabase.sql?
body: <p>I have searched on many different sites and cannot find an answer that specifically answers this question:</p>
  
  <p>I have WAMP Server installed, which installed phpmyadmin as well as MySQL. I can easily connect to the database through php/pdo by using localhost as my hostname.</p>
  
  <p>But my problem is I am trying to connect to a database that I have exported from phpmyadmin as "mydatabase.sql". So now lets say I placed this file on my pc at "C:\Users\Username\Desktop\MyFolder\mydatabase.sql". How would I connect to this database (if this is possible)?</p>
  
  <p>The reason is that I cannot install WAMP Server on all the pcs that would use this program. so would like to be able to connect to the database without having to install any type of servers, etc... </p>
  
  <p>My php at the moment is:</p>
  
  <pre><code>&lt;?php
  $dsn='mysql:C:\Users\Username\Desktop\MyFolder\mydatabase.sql';
  $username='username';
  $password='pass';
  
  try 
  {
      $dbh = new PDO("$dsn",$username,$password);
      $dbh-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
      echo 'Connected to Database&lt;br/&gt;';
  
      $sql = "SELECT * FROM users";
      foreach ($dbh-&gt;query($sql) as $row)
      {
          echo $row["ID"] ." - ". $row["Name"] ."&lt;br/&gt;";
      }
  
      $dbh = null;
  }
  catch(PDOException $e)
  {
      echo $e-&gt;getMessage();
  }
  ?&gt;
  </code></pre>
  
  <p>Also, if this is possible, would username and password be necessary to connect to an "off server database"?</p>
  
  <p>If I try:</p>
  
  <pre><code>$dsn='sqlite:C:\Users\Optique\Desktop\optique.sql';
  </code></pre>
  
  <p>I get:
  "Connected to Database
  SQLSTATE[HY000]: General error: 26 file is encrypted or is not a database"</p>
  
  <p>But I think that is because SQLite uses a different database format than MySQL (stand to be corrected). So what I need is something similar to the SQLite driver for MySQL.</p>
  
  <p>Thanks in advance!</p>