Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue related to connecting with MySQL database once docker is up #3

Open
imlokeshs opened this issue Aug 8, 2020 · 2 comments
Open

Comments

@imlokeshs
Copy link

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.

@ger86
Copy link
Owner

ger86 commented Aug 10, 2020

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

@goulashsoup
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants