P粉2957286252023-08-08 13:47:57
Put the name of my mysql container instead of 127.0.0.1
NAME CONTAINERS project-db --> container mysql project-app --> container laravel DB_CONNECTION=mysql DB_HOST=project-db DB_PORT=3306 DB_DATABASE=project DB_USERNAME=root DB_PASSWORD=root
P粉2259617492023-08-08 12:59:00
First, edit your docker-compose.yml file
mysql: image: mariadb:latest ports: - 8889:3306
Then, set the correct database port in the .env file
Your database port is wrong. You are trying to connect to an exposed port through a database instance running inside docker. In this case you should use DB_PORT=3306