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

前端 未结 24 1603
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:56

    Reason is the old database credentials are cached /bootstap/cache/config.php

    In the .env file, I modified it as follow

     DB_HOST=localhost
     DB_DATABASE=homestead
     DB_USERNAME=homestead
     DB_PASSWORD=secret
    

    Then removed that file

    /bootstap/cache/config.php 
    

    If the issue still there you might try the following.

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

    Exit vagrant by writing the exit command Then restart vargarnt/homestead config

    vagrant reload --provision
    

    Then opened vagrant again

    Vagrant Up
    Vagrant ssh
    

提交回复
热议问题