I am new to Docker and wanted to create MariaDB container. While bringing up the container I wanted to import an SQL dump which is of 50MB in size. I am using following Docker compose file which is currently taking more than 1hr to import an SQL dump.
services:
mariadb:
image: mariadb:10.1
container_name: mariadb
volumes:
- ./mountedVolume/dbvolume:/var/lib/mysql
- ./webAppDatabase/dctdatabase/appDB.sql:/docker-entrypoint-initdb.d/appDB.sql
command: --max_allowed_packet=500M
environment:
MYSQL_ROOT_PASSWORD: root123
ports:
- "3306:3306"
I have tried using following Mysql settings, before importing SQL dump
SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, AUTOCOMMIT = 0;
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS = 0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS = 0;
After importing SQL dump I have resetted the values
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
SET AUTOCOMMIT = @OLD_AUTOCOMMIT;
COMMIT;
But above settings didn't help. I have also used the Solution posted on the link but it didn't help.
I have tried by dividing SQL files into smaller chunks and importing it into MariaDB container but it was taking ~same time
I just wanted to import ~50MB of SQL dump in lesser time, I have tried all the possible ways which are available in internet but none of the solution helped me to minimise the time. Please let me know if there is an workaround.