I am trying to write the results of MySQL script to a text file using the following code in my script.
SELECT p.title, p.content, c.name FROM post p
LEFT JOI
That's because secure_file_priv is set to NULL
mysql> show variables like secure_file_priv;
| secure_file_priv | NULL |
You must stop mysql server
shell>/usr/local/mysql/support-files/mysql.server stop
Then restart mysql with the option defining where you want your files to be written to, for example to /tmp
shell>/usr/local/mysql/support-files/mysql.server start --secure-file-priv=/tmp
Then in mysql terminal you should see where your files can now be written to
mysql> show variables like secure_file_priv;
| secure_file_priv | /private/tmp/ |
On Mac you can find this folder by using Go To Folder /private/tmp in Finder