I am running Mysql
in Docker
and trying to read a csv file in this location in my local system, and push into a table in the same Mysql db
MYSQL load command
LOAD DATA LOCAL INFILE '/home/asha/Documents/2.csv' INTO TABLE test FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' IGNORE 1 ROWS;
This is where the csv is located in my local system ( Ubuntu 20 )
$HOME/Documents/1.csv
I am trying to mount this directory into the docker
docker run -p 3307:3306 -p 33061:33060 --name=mysql83 -d mysql/mysql-server:latest -v $HOME/Documents:/home
Docker doesnt run, this is what i found in docker logs
[ERROR] [MY-010147] [Server] Too many arguments (first extra is '/home/asha/Documents:/home').
[ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
Is there something wrong with the mount parameters in docker run
?
CodePudding user response:
docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...]
you need to put docker run options before the docker image
docker run -p 3307:3306 -p 33061:33060 --name=mysql83 -d -v $HOME/Documents:/home mysql/mysql-server:latest