docker-compose-laravel icon indicating copy to clipboard operation
docker-compose-laravel copied to clipboard

How can i access to mysql?

Open ghost opened this issue 3 years ago • 1 comments

I tried

PS C:\Users\rlawjddn\Desktop\Projects\docker-compose-laravel-main\src> docker-compose run --rm mysql mysql -u root -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local server through socket '/run/mysqld/mysqld.sock' (2)

Anyone help me?

ghost avatar Jan 05 '22 11:01 ghost

Not sure if still needed, but I access the mysql container with: docker exec -ti mysql bash

docker-compose run --rm on the mysql container will give issues, because after running docker-composer up --build -d site the mysql container is already running.

ricoderks avatar Feb 02 '22 12:02 ricoderks

Either follow @ricoderks advice, or if you want you can use a MySQL workbench application or something like TablePlus to access the database container. Just use 127.0.0.1:3306 unless you've changed any of the values in docker-compose.yml.

aschmelyun avatar Nov 14 '22 06:11 aschmelyun