mysqllaraveldockerlaravel-sail

How to find the password of mysql on desktop docker in laravel?


After Laravel installation by sail and docker on windows, I run the server by:

./vendaor/bin/sail up -d

and this is the containers:

enter image description here

I can't connect to MySQL by user: root and password and port 3306

docker exec -it app-mysql-1 mysql -u root -p

I delete the app-mysql-1 from app containers and Run a MySQL image but problem still exists and I can't connect to MySQL and make or migrate.

I can find the auto generated MySQL password and can change it but can't connect and use this one in app containers

enter image description here

How I can connect to MySQL in the app containers?


Solution

  • If you didn't change the default Sail database user then you should use:

    User: sail
    Password: password

    And in ./.env:

    DB_USERNAME=sail
    DB_PASSWORD=password