title: PDOException::("SQLSTATE[HY000] [2002] Connection refused" in laravel
body: <p>I have successfully installed Laravel and it running in a <code>http://127.0.0.1:8000/</code>. when I run the php artisan migrate it gives me the following error.</p>
  
  <p><code>PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=plantshop", "root", "", []) /Projects/blog/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70</code></p>
  
  <p>I can able to access my php myadmin using <a href="http://192.168.64.2" rel="nofollow noreferrer">http://192.168.64.2</a> port but not by <code>http://127.0.0.1:8000/</code> and one more thing is I have a lamp/htdocs/abc directory if I go to this link the page is not displaying and it says </p>
  
  <p><code>Access forbidden!
  You don't have permission to access the requested object. It is either read-protected or not readable by the server.
  If you think this is a server error, please contact the webmaster.</code></p>
  
  <p>I have tried changing the port number and directly pointed unix_socket to php myadmin but none of its working. what is wrong with my configuration? I am using a mac, could anyone help me out?</p>
  
  <p>my .env file</p>
  
  <pre><code>DB_CONNECTION=mysql
  DB_HOST=127.0.0.1
  DB_PORT=3306
  DB_DATABASE=plantshop
  DB_USERNAME=root
  DB_PASSWORD=
  </code></pre>
  
  <p>Databse.php</p>
  
  <pre><code>'mysql' =&gt; [
              'driver' =&gt; 'mysql',
              'host' =&gt; env('DB_HOST', '127.0.0.1'),
              'port' =&gt; env('DB_PORT', '3306'),
              'database' =&gt; env('DB_DATABASE', 'forge'),
              'username' =&gt; env('DB_USERNAME', 'forge'),
              'password' =&gt; env('DB_PASSWORD', ''),
              'unix_socket' =&gt; env('DB_SOCKET', ''),
              'charset' =&gt; 'utf8mb4',
              'collation' =&gt; 'utf8mb4_unicode_ci',
              'prefix' =&gt; '',
              'prefix_indexes' =&gt; true,
              'strict' =&gt; true,
              'engine' =&gt; null,
  
              'options' =&gt; extension_loaded('pdo_mysql') ? array_filter([
                  PDO::MYSQL_ATTR_SSL_CA =&gt; env('MYSQL_ATTR_SSL_CA'),
              ]) : [],
          ],
  </code></pre>