当我执行命令cat hkexchina-05-12-19.sql | docker exec -i hkex-ch-qa-cms_db_1 /usr/bin/mysql -uhellow --password=Tmslaws123 hkex
将数据库导入docker容器时,我试图在docker容器中导入1.2GB大小的数据库,但出现以下错误
程序'docker.exe'运行失败:类型异常 引发了'System.OutOfMemoryException'。在第1行char:31
我增加了用于mysql容器的内存,这是我的docker-compose文件
version: "3"
services:
www:
build: .
ports:
- "8001:80"
volumes:
- ./hkex_update:/var/www/html/
links:
- db
db:
image: mtirsel/mysql-5.1
deploy:
resources:
limits:
memory: 5G
reservations:
memory: 4G
ports:
- "3307:3306"
environment:
MYSQL_DATABASE: hkex
MYSQL_USER: hellow
MYSQL_PASSWORD: Tmslaws123
MYSQL_ROOT_PASSWORD: Tmslaws123
volumes:
- ./dump:/docker-entrypoint-initdb.d
- persistent:/var/lib/mysql
volumes:
persistent:
任何人都可以让我知道我在哪里做错了。
答案 0 :(得分:0)
我已通过以下步骤解决了这个问题
First I copied the SQL file to the root of docker container using docker CP command
> docker cp filename containername:/filename
Then I exec the MySQL container and use the database where I want to import my SQL file use
> use SQL Statement
Finally, I used the below command and hit enter it started importing the SQL file
> source SQL-filename