ERROR 1290 (HY000): The MySQL server is running with the –secure-file-priv option so it cannot execute this statement


You want to export a MySQL database table as a csv with something like:

but you get the error that MySQL cannot execute this command.


Find out the location that MySQL can use to export files by running the following:

and then use the path to change the outfile path (ie /var/lib/mysql-files/table_name.csv).

Taken from the answer here