Sponsored

Not the solution you were looking for?

We’ll help you out!

Secure_file_priv option in MySQL – Modify/Disable

If you are getting an error “The MySQL server is running with the secure_file_priv option so it cannot execute this statement” while using ‘LOAD DATA INFILE‘ or ‘INTO OUTFILE‘, then here’s how you can fix it.

Here are the snapshots of the error:

mysql> select option_value from wp_options WHERE option_value LIKE ('%sess%') INTO OUTFILE '/tmp/sam.txt';
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

You might also get the above error while loading data file using ‘LOAD DATA INFILE‘ in MySQL.

To fix this error, you need to check the value of ‘secure_file_priv‘ option.

As you can see the value of ‘secure_file_priv‘ is ‘/var/lib/mysql-files‘. It means, if you ever want to load a file (import), then the file should be located within this directory. Similarly, if you want to output into a file (export), then it can only output to file that’s located within this directory. Let’s check this now!

Thanks for knowledge sharing : o)
Unfortunately it did not work for me when i tried to disable secure_file on Ubuntu 18.04, mysql –version: mysql Ver 14.14 Distrib 5.7.23, for Linux (x86_64) using EditLine wrapper