title: Laravel 5.1 - Connecting to MySQL Database (MAMP)
body: <p>There are topics online that are discussing this problem however, I couldn't find any tidy explanation of the problem or any solid answers for the question. What I am trying to achieve is connecting Laravel 5.1 to MySQL Database of MAMP.</p>
  
  <hr>
  
  <p>In my <strong><em>config>app.php:</em></strong></p>
  
  <pre><code>   'default' =&gt; env('DB_CONNECTION', 'mysql'),
  
  
     'mysql' =&gt; [
          'driver'    =&gt; 'mysql',
          'host'      =&gt; 'localhost:8889',
          'database'  =&gt; 'test',
          'username'  =&gt; 'root',
          'password'  =&gt; 'root',
          'charset'   =&gt; 'utf8',
          'collation' =&gt; 'utf8_unicode_ci',
          'unix_socket'   =&gt; '/Applications/MAMP/tmp/mysql/mysql.sock',
          'prefix'    =&gt; '',
          'strict'    =&gt; false,
      ],
  </code></pre>
  
  <p>In my <strong><em>.env:</em></strong></p>
  
  <pre><code>      DB_HOST=localhost
        DB_DATABASE=test
        DB_USERNAME=root
        DB_PASSWORD=root
  </code></pre>
  
  <p>I also have <strong><em>.env.example:</em></strong> (which I believe has no functionality)</p>
  
  <pre><code>      DB_HOST=localhost
        DB_DATABASE=homestead
        DB_USERNAME=homestead
        DB_PASSWORD=secret
  </code></pre>
  
  <p>I also have <code>create_users_table.php</code> and <code>create_password_resets_table.php</code> in my <strong><em>database>migrations</em></strong> (even though I did not run any migration:make)</p>
  
  <hr>
  
  <p>MAMP is directing and running the server successfully as it loads the project on localhost.</p>
  
  <hr>
  
  <p>Here is my MAMP settings:</p>
  
  <p><a href="https://imgur.com/T3KczgP" rel="noreferrer"><img src="https://i.imgur.com/T3KczgP.png" title="source: imgur.com" /></a></p>
  
  <p><a href="https://imgur.com/wbySSkJ" rel="noreferrer"><img src="https://i.imgur.com/wbySSkJ.png" title="source: imgur.com" /></a></p>
  
  <p>And the <code>test</code> database is created (with tables in it which I have previously created and used in my other projects, not Laravel.)</p>
  
  <p><a href="https://imgur.com/4V2r913" rel="noreferrer"><img src="https://i.imgur.com/4V2r913.png" title="source: imgur.com" /></a></p>
  
  <hr>
  
  <p>Even though everything seems correct to me, when trying to submit Auth form, I am getting this error:</p>
  
  <blockquote>
    <h3>PDOException in Connector.php line 50:
    could not find driver</h3>
    
    <ol>
    <li><p>in Connector.php line 50</p></li>
    <li><p>at PDO->__construct ('mysql:unix_socket=/Applications/MAMP/tmp/mysql/mysql.sock;dbname=test', 'root', 'root', array('0', '2', '0', false, false)) in Connector.php line 50</p></li>
    <li><p>at Connector->createConnection('mysql:unix_socket=/Applications/MAMP/tmp/mysql/mysql.sock;dbname=test', array('driver' => 'mysql', 'host' => 'localhost:8889', 'database' => 'test', 'username' => 'root', 'password' => 'root', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock', 'prefix' => '', 'strict' => false, 'name' => 'mysql'), array('0', '2', '0', false, false)) in MySqlConnector.php line 22</p></li>
    </ol>
    
    <p>and so on...</p>
  </blockquote>