If you're encountering the following error:
The MySQL server is running with the –secure-file-priv option so it cannot execute this statement
This is generally as a result of exporting results to a directory not deemed secure by MySQL. To solve this you can find out which directories are deemed as secure by executing the following command in the MySQL prompt:
show variables like 'secure_file_priv';
The default directory is:
/var/lib/mysql-files