Laravel sail change db username and password? Hello I downloaded a fresh laravel 8 application and I am using sail
By default the .env file that was created has
DB_USERNAME=sail
DB_PASSWORD=password
but I need to change these and use my own
How is this possible?
for now I am simply trying to change them to root/root
and I get Access denied for user 'root'@...
@pefremidis because there is no root/root on your Sail setup.
May I know why you are changing the defaults? Did you intend to use a MySQL DB outside Sail?
I have multiple sites that use sail and each one has its own defaults for username and password.
So when I am changing projects it is annoying to switch credentials in order to connect with table plus for example
@pefremidis Sail only gets the credentials on your .env file, so change your .env file first and rebuild your sail using:
sail build --no-cache
sail up -d
And root/root should work.
@pefremidis hmm, it must be the volume, try:
sail down -v
sail build --no-cache
sail up -d
Oh
everything is ok now!
Thanks
Wowwww. I lost half day trying to resolve this. Thx @neilstee !!!!
@neilstee Thank you my friend, that worked for me !
I don't understand your pb, therei is nothing special to do normally, the values you define in .env are taken by docker compose and so by sail cde
It works without pb for me with postgresql.
If anyone is still having issues I'd like to add on top of @neilstee 's answer.
sail down -v
sail up -d
sail artisan config:cache
sail artisan migrate
Please sign in or create an account to participate in this conversation.