1

I trie to update my schema in symfony with my docker container.

Have a pdo exception :

[PDOException]
SQLSTATE[HY000] [2002] Connection refused

my docker-compose work thine with phpmyadmin:

version: "3" services: web: image: nginx:latest ports: - "3636:80" volumes: - .:/code - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf links: - php php: build: ./docker/engine links: - db:mysql volumes: - .:/code db: image: mysql:5.7 ports: - "3306:3306" expose: - "3306" volumes: - db_data:/var/lib/mysql environment: MYSQL_ROOT_PASSWORD: root MYSQL_USER: xxx MYSQL_PASSWORD: xxx MYSQL_DATABASE: xxx phpmyadmin: image: phpmyadmin/phpmyadmin links: - db:mysql ports: - 76:80 environment: MYSQL_USERNAME: root MYSQL_ROOT_PASSWORD: root volumes: db_data: 

My parameter.yml :

 database_host: db database_port: 3636 database_name: xxx database_user: xxx database_password: xxx 

I don't understand this anymore ! Thx for your help

2 Answers 2

1

The port exposed and used by the database container is 3306. So in the parameters.yml try

 database_port: 3306 

instead of

 database_port: 3636 

Hope this help

Sign up to request clarification or add additional context in comments.

1 Comment

Oh sh** ! Thx Is realy helpfull
0

Your nginx working on the 3636, db working on the 3306, change database_port in your parameters.yml from 3636 to 3306, if your code live inside Docker - remove

 ports: - "3306:3306" 

and steel exposes 3306 for MySQL and other services only inside Docker.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.