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

前端 未结 5 705
春和景丽
春和景丽 2021-01-12 19:57

Why is the following error occurring?

QueryException SQLSTATE[HY000] [1045] Access denied for user \'homestead\'@\'localhost\' (using password: YES)

相关标签:
5条回答
  • 2021-01-12 20:25

    You should clear the cache after changing info in the .env file.

    Run the following commands:

    php artisan cache:clear 
    php artisan config:clear 
    php artisan config:cache  
    
    0 讨论(0)
  • 2021-01-12 20:31

    It's either you edit a wrong file or you have not saved the .env yet. Because in your error message, it looks like you access the database using user homestead on localhost database, not root on student_management. Make sure you edit the correct .env, not .env.example. cheers

    0 讨论(0)
  • 2021-01-12 20:36

    You can use these commands to solve the problem

    php artisan cache:clear 
    php artisan config:clear 
    php artisan config:cache 
    

    These commands are use to clear the cache.

    0 讨论(0)
  • 2021-01-12 20:43

    Add the blank quotes in front of password like this

    DB_PASSWORD=""

    In the case if you have an empty password.
    Hope this solution will work

    0 讨论(0)
  • 2021-01-12 20:46

    Cleaning out the system caches...for example for the PhpMyStorm IDE

    On the main menu, choose File | Invalidate Caches/Restart. The Invalidate Caches message appears informing you that the caches will be invalidated and rebuilt on the next start. Use buttons in the dialog to invalidate caches, restart PhpStorm or both.

    0 讨论(0)
提交回复
热议问题