title: SQLSTATE[HY000] [1049] Unknown database - Database created, not functioning
body: <p>I have this in my .env file</p>
  
  <pre><code>    APP_ENV=local
      APP_DEBUG=true
      APP_KEY=m6twKy7Lr6KKFvVa7QgXUe78xfn08MLn
  
      DB_HOST=localhost
      DB_DATABASE=laravel1
      DB_USERNAME=root
      DB_PASSWORD=somepass
  
      CACHE_DRIVER=file
      SESSION_DRIVER=file
      QUEUE_DRIVER=sync
  
      MAIL_DRIVER=smtp
      MAIL_HOST=mailtrap.io
      MAIL_PORT=2525
      MAIL_USERNAME=null
      MAIL_PASSWORD=null
      MAIL_ENCRYPTION=null
  </code></pre>
  
  <p>And this is in my database.php</p>
  
  <pre><code>   'mysql' =&gt; [
          'driver'    =&gt; 'mysql',
          'host'      =&gt; env('DB_HOST', 'localhost'),
          'database'  =&gt; env('DB_DATABASE', 'forge'),
          'username'  =&gt; env('DB_USERNAME', 'forge'),
          'password'  =&gt; env('DB_PASSWORD', ''),
          'charset'   =&gt; 'utf8',
          'collation' =&gt; 'utf8_unicode_ci',
          'prefix'    =&gt; '',
          'strict'    =&gt; false,
      ],
  </code></pre>
  
  <p>The database is created and I can see it in phpMyAdmin in browser.</p>
  
  <p><a href="https://i.stack.imgur.com/Jki2Q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jki2Q.png" alt="enter image description here"></a></p>
  
  <p>But when I write <code>php artisan migrate</code> I get this error:</p>
  
  <p>[PDOException]
    SQLSTATE[HY000] [1049] Unknown database 'laravel1'</p>
  
  <p>I have seen the answers on 
  <a href="https://stackoverflow.com/questions/22750995/laravel-migration-says-unknown-database-but-it-is-created">Laravel Migration - Says unknown database, but it is created</a> , but that didn't helped me.</p>