Sometimes importing mysql data into docker is very slow

I have a * .SQL file over 1 GB, when I import into Mysql on local or Vagrant, it is always successful. But with the same file I import into Mysql on Docker, it is very very slow (about 10 MB / 15 minutes). I checked many times with the same result. I tried a lot of files; this happens with the specified files. I do not know the reason. I need help.

This is my docker-compose.yml:

version: "2.0"
services:
 database:
  image: "mysql/mysql-server:5.5"
  ports:
   - "3307:3306"
  volumes:
   - "db:/var/lib/mysql"
   - ./sql:/home/sql
  environment:
   MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
 volumes:
  db: {}
+4
source share
1 answer

I use docker in windows ... My solution is that it moves the .sql file to the mysql Docker container and does the import manually.

  • Export .sql from mysql production server ...

  • Copy file to mysql Docker container

docker cp base_ok.sql docker_mysql_1:/home/base_ok.sql

  • bash docker mysql

    docker exec -ti docker_mysql_1 bash

  • DDBB

    mysql -p -u root magento < base_ok.sql

, - docker_mysql_1, , docker ps

+2

Source: https://habr.com/ru/post/1671961/


All Articles