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


  • | 208 points

    I must be stupid, and I'm surprised no one else has had this problem yet but I run into the following problem:

    After installing Laragon and following the videos on laracasts.com, I'm now running into the problem of not being able to run migrations.
    Even when I try to run php artisan migrate:status I get the following error:

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

    My .env file looks like this (it's the default file)

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

    All these settings are from the default installation. What am I doing wrong, and how can I fix it?


  • administrators
    | 48370 points

    @Undutchable: No worry :)

    1. First, click Start to ensure MySQL is running
      then open **Terminal ** and create a database, example "homestead"
     mysqladmin -u root  create 'homestead' 
    
    1. Change your .env file to
    DB_HOST=localhost
    DB_DATABASE=homestead
    DB_USERNAME=root
    DB_PASSWORD=
    

  • | 208 points

    Thanks. It wasn't clear to me that the databases didn't exist yet.


  • administrators
    | 48370 points

    You're welcome :)


  • | 54 points

    @leokhoa I immediately registered an account just to say this: i have spent three days trying to figure this out and nowhere have i seen to create a database the way you explained it. i am so happy. thank you so much.


  • administrators
    | 48370 points

    @farmanp : You're welcome ;)


Log in to reply
 

Looks like your connection to Laragon was lost, please wait while we try to reconnect.