0

I created MySQL cluster of nodes (2 datanodes, 1 management node, and 1 MySQL server node) on Docker Following the instructions from this link:

https://mysqlmed.wordpress.com/2017/09/04/mysql-cluster-in-docker-quick-step-by-step

Then I created a MySQL table to import a csv file (named daily.csv) using the command:

LOAD DATA INFILE 'C:/Users/Utilisateur/Desktop/daily.csv' INTO TABLE daily IGNORE 1 LINES;

and I got the error:

ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement.

When I add LOAD DATA LOCAL INFILE ..

I get this error:

ERROR 2 (HY000): File 'C:/Users/Utilisateur/Desktop/daily.csv' not found (Errcode: 2 - No such file or directory)

When i check my secure-file-priv using the command:

SELECT @@global.secure_file_priv

I get the Following path: /var/lib/mysql-files/ but I have no idea how to access to it in order to copy my csv file, or even to access my.ini MySQL config file to change the variable secure-file-priv into NULL, which as I saw is another solution to get permissions to access my file.

As I am using Docker, I have no idea how to access the MySQL container config file.

I tried many ways but I see no issue. Could you please help me with this I would be very delighted as I spent a lot of time trying to fix it??

I followed these instructions but don't know where the file /etc/mysql/my.cnf to change the variable secure_file_priv to NULL is:

Mysql making --secure-file-priv option to NULL

J. Scott Elblein
  • 4,013
  • 15
  • 58
  • 94
k_bm
  • 81
  • 1
  • 10

1 Answers1

2

In your case it might be sufficient to mount your local directory inside the directory expected by mysql (/var/lib/mysql-files/).

Try starting the container with an additional -v parameter, like this:

docker run -d -v C:/Users/Utilisateur/Desktop/:/var/lib/mysql-files --net=cluster --name=mysql1 --ip=192.168.0.10 -e MYSQL_RANDOM_ROOT_PASSWORD=true mysql/mysql-cluster mysqld

Or copy the file into the folder:

docker cp C:/Users/Utilisateur/Desktop/daily.csv mysql1:/var/lib/mysql-files

assuming the name of your container is mysql1, as in the link you provided.

J. Scott Elblein
  • 4,013
  • 15
  • 58
  • 94
andrzejwp
  • 922
  • 4
  • 11