Docker Compose mysql import .sql

前端 未结 5 713
伪装坚强ぢ
伪装坚强ぢ 2021-01-31 16:32

I\'m having trouble importing an .sql dump file with docker-compose. I\'ve followed the docs, which apparently will load the .sql file from docker-entrypoint-initdb.d. However,

5条回答
  •  攒了一身酷
    2021-01-31 17:07

    Mysql database dump schema.sql is resides in the /mysql-dump/schema.sql directory and it creates tables during the initialization process.

    docker-compose.yml:

    mysql:
        image: mysql:5.7
        command: mysqld --user=root
        volumes:
          - ./mysql-dump:/docker-entrypoint-initdb.d
        environment:
          MYSQL_DATABASE: ${MYSQL_DATABASE}
          MYSQL_USER: ${MYSQL_USER}
          MYSQL_PASSWORD: ${MYSQL_PASSWORD}
          MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
    

提交回复
热议问题