0

I dockerised my project symfony it works well. I run command sudo docker-compose run php bin/console doctrine:schema:update --force.

And I have this error : An exception occurred in driver: could not find driver

docker-compose.yml

eversion: '2'
services:
nginx:
    build: nginx
    ports:
        - "8080:80"
    links:
        - php
    volumes_from:
        - php
    volumes:
        - ./logs/nginx/:/var/log/nginx
        - ./symfony:/var/www/symfony
db:
    image: mysql
    ports:
        - 3307:3307
    volumes:
        - "./.data/db:/var/lib/mysql"
    environment:
      MYSQL_ROOT_PASSWORD: nolan
      MYSQL_USER: nolan
      MYSQL_PASSWORD: nolan
    ports:
      - "8002:3307"
php:
    build: php7-fpm
    ports:
        - 9002:9000
    links:
        - db:mysql
    volumes:
        - ./symfony:/var/www/symfony
        - ./logs/symfony:/var/www/symfony/app/logs

.env symfony

DATABASE_URL=mysql://nolan:[email protected]:8002/musiques
4
  • To me it looks like the DATABASE_URL is wrong. I would expect it to be DATABASE_URL=mysql://nolan:nolan@db:3307/musiques. @db references the db-service from your docker-compose.yml. The port 8002 is the one being exposed to your host system, but is not the one used between the containers Commented Jan 21, 2019 at 16:18
  • As far as I know the default port for mysql is 3306 though. So it might be that there is nothing running on the port you are exposing? Commented Jan 21, 2019 at 16:18
  • I change prot to 3306, i have same an error Commented Jan 21, 2019 at 16:24
  • The could not find driver could hint at a missing pdo_mysqldriver. Could you also add your Dockerfile for the php container to the question? Commented Jan 21, 2019 at 17:59

1 Answer 1

2

Install php pdo MySQL package inside your php container.

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

3 Comments

si i have an other error An exception occurred in driver: SQLSTATE[HY000] [2054] The server requeste d authentication method unknown to the client
Are you on mysql8?
If so I think they changed something with the hashes. But not sure. You should google it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.