Mysql database imports or exports from a file to a file, prompting The MySQL server is running with the --secure-file-priv option so it cannot execute this statement. The reasons and solutions are as follows:

Some versions of mysql have restrictions on import and export through files, which are not allowed by default.

View the configuration and execute the mysql command

SHOW VARIABLES LIKE "secure_file_priv";

If the value value is null, it is prohibited. If there is a folder directory, only the files in the directory are allowed to be changed (testing subdirectories will not work). If it is empty, the directory is not restricted;

To modify the configuration, you can modify the mysql configuration file to see if there is

secure_file_priv =

If there is no such line of content, add it manually.

secure_file_priv = /home

Indicates that it is limited to the /home folder

secure_file_priv =

Indicates that the directory is not restricted, and the equal sign must be present, otherwise mysql cannot be started.

After modifying the configuration file, restart mysql to take effect.


Leave a Reply