Docker Compose mysql import .sql

前端 未结 5 705
伪装坚强ぢ
伪装坚强ぢ 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:08

    This worked for me,

    version: '3.1'
    
    services:
    
      db:
        image: mysql
        command: --default-authentication-plugin=mysql_native_password
        restart: always
        volumes:
          - ./mysql-dump:/docker-entrypoint-initdb.d
        environment:
          MYSQL_ROOT_PASSWORD: example
          MYSQL_DATABASE: ecommerce
    
      adminer:
        image: adminer
        restart: always
        ports:
          - 8080:8080
    

    mysql-dump must be a directory. All the .sql's in the directory will be imported.

提交回复
热议问题