laravelpdo

Laravel: SQLSTATE[28000] [1045] Access denied for user 'homestead'@'localhost'


I just installed laravel and made a migration. But when i try to run it i get this error:

[PDOException]                                                               
  SQLSTATE[28000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)  

Can anyone tell me what is wrong? I think the Database.php file looks different than normal. Is this something new in the new Laravel?

My Database config:

'mysql' => [
            'driver'    => 'mysql',
            'host'      => env('DB_HOST', 'localhost'),
            'database'  => env('DB_DATABASE', 'LaraBlog'),
            'username'  => env('DB_USERNAME', 'root'),
            'password'  => env('DB_PASSWORD', 'root'),
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
            'strict'    => false,
        ],

Hope someone can help me :)


Solution

  • Try to check out the ".env" file in your root directory. These values are taken first. Yours are just the defaults if there are none given in the .env file.

    DB_CONNECTION=mysql 
    DB_HOST=127.0.0.1
    DB_PORT=3306
    DB_DATABASE=Your_Database_Name
    DB_USERNAME=Your_UserName
    DB_PASSWORD=Your_Password