title: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO)
body: <p>I want to take all information from my database. Bu when i refresh the page error access denied occurs. How can i solve this. Can you please help me? </p>
  
  <p>this is database.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; '',
          'strict' =&gt; true,
          'engine' =&gt; null,
      ],
  </code></pre>
  
  <p>this is .env;</p>
  
  <pre><code>APP_NAME=Laravel
  APP_ENV=local
  APP_KEY=base64:HMSysJsvQBx9lKnctKT2Z+7Gv//of2W8O18uD+5wO0o=
  APP_DEBUG=true
  APP_URL=http://localhost
  
   LOG_CHANNEL=stack
  
   DB_CONNECTION=mysql
   DB_HOST=127.0.0.1
   DB_PORT=3306
   DB_DATABASE=blog
   DB_USERNAME=root
   DB_PASSWORD=
  </code></pre>
  
  <p>The error is: 
  <strong>"SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) (SQL: select * from <code>tasks</code>)"</strong></p>