SQL >> Database teknologi >  >> RDS >> Mysql

Importér SQL-dumps med Docker Compose MySQL

Dockers MySQL-image kan automatisk importere .sql-filer placeret i /docker-entrypoint-initdb.d. Med Docker Compose monterer du en lokal dump-mappe til den sti.

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

Mappen mysql-dump skal findes lokalt. Alle SQL-filer indeni importeres under containerens initialisering.

  1. Importér .sql-fil i Access

  2. Importér en stor .sql-fil til MySQL

  3. Ændring af my.cnf-indstillinger i MySQL Docker-imaget

  4. Kør MySQL på port 3307 med Docker Compose