Can’t connect to MySQL docker container

By Friandy

I have an issue with my MySQL container, i can’t connect to container.

This is my docker-compose.yml

apache:
build: ./
ports:
    - 1814:80
volumes:
    - ./code:/app
links:
    - db
environment:
    - APACHE_SERVER_NAME=local.dev
    - PHP_SHORT_OPEN_TAG=On
    - PHP_ERROR_REPORTING=E_ALL
    - PHP_DISPLAY_ERRORS=On
    - PHP_HTML_ERRORS=On
db:
image: mysql:5.6
ports:
    - "3333:3306"
volumes:
    - /var/lib/mysql
environment:
    MYSQL_ROOT_PASSWORD: admin
    MYSQL_DATABASE: app

I run with docker-compose up -d --build.

After that, i use docker ps to see running container

https://i.imgsafe.org/3caf28c5f0.png

Then i use docker exec -it mddev_apache_1 /bin/bash to running an interactive shell in mddev_apache_1 container.

But when i trying to connect to MySQL, its refused.

https://i.imgsafe.org/3ccfde1f73.png

Any idea why i can’t connect to MySQL container ?

Thanks.

Source: Stack Overflow

    

Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273