I am learning MySQL and tried using a LOAD DATA
clause. When I used it as below:
LOAD DATA INFILE \"text.txt\" INTO table mytable;
If you're running on Ubuntu, you may also need to configure Apparmor to allow MySQL to write to your folder, e.g. here's my configuration:
Add this line to file /etc/apparmor.d/usr.sbin.mysqld :
/var/lib/mysql-files/* rw
Then add these 2 config lines to /etc/mysql/my.cnf sections:
[client]
loose-local-infile = 1
[mysqld]
secure-file-priv = ""
Here's my SQL:
select id from blahs into outfile '/var/lib/mysql-files/blahs';
It worked for me. Good luck!