title: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost'
body: <p>I make php artisan make:auth and tried to register as a new user then I get the error. I am using Xampp for MySQL and make a database name 'pari' and set user: root and password: root. After starting xampp apache and SQL server and PHP artisan serve on cmd I get the same error every time.  </p>
  
  <blockquote>
    <p>SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) (SQL: select count(*) as aggregate from <code>users</code> where <code>email</code> = avinashjk1620@gmail.com)</p>
  </blockquote>
  
  <p>Step 1: I have changed .env file </p>
  
  <pre><code>DB_CONNECTION=mysql
  DB_HOST=127.0.0.1
  DB_PORT=3306
  DB_DATABASE=pari
  DB_USERNAME=root
  DB_PASSWORD=root
  </code></pre>
  
  <p>and restart using php artisan serve , but again it gave that error.</p>
  
  <p>Step 2: I have changed config\database.php to-</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', 'pari'),
          'username' =&gt; env('DB_USERNAME', 'root'),
          'password' =&gt; env('DB_PASSWORD', 'root'),
          '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>but it again gave that same error. 
  Step 3: I tried </p>
  
  <pre><code>  php artisan cache:clear 
    php artisan config:clear
  </code></pre>
  
  <p>but again get same error.</p>
  
  <p>Step 4: After removing password from phpmyadmin and .env and database.php I get new error-</p>
  
  <pre><code>  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'pari.users' doesn't exist (SQL: select count(*) as aggregate from `users` where `email` = avinashjk1620@gmail.com)
  </code></pre>
  
  <p>How can i fixed this error Please help me.</p>