Hi! It seems that with a sail installation is not so simple to change DB user and password. It always uses the sail/password defaults. By changing values in .env file, nothing happens, even after restarting or rebuilding the docker containers. So how to?
To change the DB user and password in a Sail installation, you need to update the .env file and then rebuild the Docker containers.
Here are the steps to follow:
Open the .env file in the root directory of your Laravel project.
Locate the DB_USERNAME and DB_PASSWORD variables.
Update the values of these variables with the desired DB user and password.
Save the changes to the .env file.
In your terminal, navigate to the root directory of your Laravel project.
Run the following command to rebuild the Docker containers:
sail build --no-cache
After the containers have been rebuilt, run the following command to restart the containers:
sail up -d
Now, the DB user and password should be updated and used by your Sail installation.
If you're still experiencing issues, make sure that you're updating the correct .env file and that you're running the commands from the correct directory.
I have the same issue, the solution above does not work either. I can only successfully run the sql docker container when the details in the .env are default.