Laravel 5 error SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)

前端 未结 24 1597
Happy的楠姐
Happy的楠姐 2021-02-03 19:23

I have installed Laravel 5 successfully and changed MySQL credentials in database.php file in config directory to \'

mysql\' => [
            \'driver\'           


        
24条回答
  •  情书的邮戳
    2021-02-03 19:42

    Jeez! Thanks to umair.ashfr answer here below, I finally hit the nail with an issue that was eating my neurons.

    I had a password like DB_PASSWORD=ffjdh5#fgr on my .env, and MySQL connection was gracefully saying that "SQLSTATE[HY000] [1045] Access denied for user...", no matter what flavor of php artisan I was trying to run.

    The problem was that "#" sign inside the password. BEWARE! That means the start of a comment, thus my password was silently truncated! The solution is to declare password like DB_PASSWORD="ffjdh5#fgr"

    Regards

提交回复
热议问题