Issue related to connecting with MySQL database once docker is up
Hi,
Once the docker is up all the three containers are running and when I tried to connect with MySQL database. I couldn't connect with symfony framework..Kindly help me on this to proceed further.
Have you set up the env variable for DATABASE_URL in your .env.local file inside symfony folder?
DATABASE_URL=mysql://app_user:helloworld@db:3306/app_db?serverVersion=5.7
I couldn't connect with symfony framework
I got it to work by adding a container_name for the services.db configuration in the .docker/docker-compose.yml:
...
services:
db:
container_name: mysql_container
image: mysql:8.0.23
platform: linux/x86_66
...
Then use the container name as domain name:
DATABASE_URL=mysql://app_user:helloworld@mysql_container:3306/app_db?serverVersion=8.0.23&charset=utf8mb4