I am learning MySQL and tried using a LOAD DATA
clause. When I used it as below:
LOAD DATA INFILE \"text.txt\" INTO table mytable;
in Linux you have to edit my.cnf file in
/etc/mysql/my.cnf
and change 26 line number
param like this :
secure-file-priv=
then restart your MySQL and try again.
in docker you have to mount your my.cnf file with my.cnf file in your container with this command in docker-compose or add manually :
volumes:
- ./persistent:/var/lib/mysql
- ./conf/my.cnf:/etc/mysql/my.cnf
next change /conf/my.cnf in your host and config secure-file-priv param like the upper approach, in addition, you have to mount your data in mysql container and set that path for secure-file-priv param and restart your services and finally, you can load your data.
you can check your config with this command :
SHOW VARIABLES LIKE "secure_file_priv";