I want to get SQL LOAD_FILE function to work and have read every single question/answer + documentation about this, but here is what\'s been happening.
When
So I been banging my head against this issue with finally found to to resolve it:
mysql> select LOAD_FILE('/var/www/upload/test.zip');
+---------------------------------------+
| LOAD_FILE('/var/www/upload/test.zip') |
+---------------------------------------+
| NULL |
+---------------------------------------+
1 row in set (0.00 sec)
The problem is the secure_file_priv is not set. To see where it is pointed to do the following query:
Perform query:
select @@GLOBAL.secure_file_priv;
To point to the area that you are looking to pull file What I did was to add the following to the end mysqld.conf
secure_file_priv = /var/www/upload.
Restarted mysql and test with
mysql> select LOAD_FILE('/var/www/upload/test.zip');
+--------------------------------------------------------------------------------------