Encountered when importing data into mysql table using the following command mysql
“MySQL server is running with the –secure-file-priv” Error
mysql> LOAD DATA LOCAL INFILE '/path/pet.txt' INTO TABLE pet;
The reason is that the value of "secure_file_priv" this setting, the default is NULL, which forbid us to import data.
Use show variables like% secure% can see "secure_file_priv" default configuration.
Description MySQL official website of this configuration
https://dev.mysql.com/doc/refman/8.0/en/option-files.html
To change the configuration of it where, see mysql official website answers
https://dev.mysql.com/doc/refman/8.0/en/option-files.html
Because I use the docker mysql, so I have this configuration /etc/mysql/my.cnf
Or vi with vim open /etc/mysql/my.cnf, seen its default value is NULL, this default value is changed to one of the other two values above official website inside it.
However, this does not solve the problem mysql docker, and will report does not support this version of the problem after the import data.
so, determined to give up.
So there would be no trouble, directly with customers navicate like the end of the import data, the perfect solution.
Reference links:
secure_file_priv
https://computingforgeeks.com/how-to-solve-mysql-server-is-running-with-the-secure-file-priv-error/
start / stop / restart initiate various methods of stopping the restart mysql
https://coolestguidesontheplanet.com/start-stop-mysql-from-the-command-line-terminal-osx-linux/
MySQL官网 load date into table,这个有个用于示例的数据库表。
https://dev.mysql.com/doc/refman/8.0/en/loading-tables.html