DataBase/MYSQL

How to run mySQL through docker-compose.

Naranjito 2022. 1. 13. 18:45
  • docker-compose.yml

Run mySQL through docker-compose.

version: '3.1'
  
services:

  db:
    image: mysql
    command: --default-authentication-plugin=mysql_native_password
    environment:
      MYSQL_ROOT_PASSWORD: jh
      MYSQL_DATABASE: DB_SQLSTK
    volumes:
      - ./DB_SQLSTK_FULL_FOR_BOOK_20210521.sql:/docker-entrypoint-initdb.d/schema.sql:ro
    ports:
      - 3306:3306

  adminer:
    image: adminer
    ports:
      - 8080:8080
~                                                                               
"docker-compose.yml" 19L, 394C

 

How to input the SQL file through database is set up the volume.

volumes:
      - ./DB_SQLSTK_FULL_FOR_BOOK_20210521.sql:/docker-entrypoint-initdb.d/schema.sql:ro

 

'DataBase > MYSQL' 카테고리의 다른 글

Primary Key, Foreign Key  (0) 2022.07.25
SQL, Docker-compose, Python module  (0) 2022.02.03
Common SQL queries in Pandas  (0) 2022.01.24
SQL error:may be the input source is a directory or a block device  (0) 2022.01.24
MYSQL Query  (0) 2022.01.13