richpri
Technical User
- Oct 10, 2012
- 2
I am having a problem getting LOAD_FILE to work on my local MYSQL server.
I researched this problem guided by this manual entry.
I am indeed getting a return of NULL as can be seen here:
The file permissions look as follows:
My MYSQL version is:
I checked the variables mentioned above and they seem ok:
And the FILE privilege has been granted:
I am at a loss as to what else to check. Any suggestions?
I researched this problem guided by this manual entry.
Code:
LOAD_FILE(file_name)
Reads the file and returns the file contents as a string. To use this function,
the file must be located on the server host, you must specify the full path
name to the file, and you must have the FILE privilege. The file must be readable
by all and its size less than max_allowed_packet bytes. If the secure_file_priv
system variable is set to a nonempty directory name, the file to be loaded must
be located in that directory.
If the file does not exist or cannot be read because one of the preceding
conditions is not satisfied, the function returns NULL.
I am indeed getting a return of NULL as can be seen here:
Code:
mysql> select LOAD_FILE('/home/rich/NetBeansProjects/BOARD18/data/testBox.json');
+--------------------------------------------------------------------+
| LOAD_FILE('/home/rich/NetBeansProjects/BOARD18/data/testBox.json') |
+--------------------------------------------------------------------+
| NULL |
+--------------------------------------------------------------------+
1 row in set (0.00 sec)
The file permissions look as follows:
Code:
rich@rich2:~$ ls -l NetBeansProjects/BOARD18/data/
total 8
-rw-rw-r-- 1 rich mysql 1452 Sep 22 07:41 testBox.json
-rw-rw-r-- 1 rich mysql 378 Sep 22 14:15 testSession.json
rich@rich2:~$
Code:
mysql> select @@version;
+-------------------------+
| @@version |
+-------------------------+
| 5.5.24-0ubuntu0.12.04.1 |
+-------------------------+
1 row in set (0.00 sec)
I checked the variables mentioned above and they seem ok:
Code:
mysql> select @@max_allowed_packet;
+----------------------+
| @@max_allowed_packet |
+----------------------+
| 16777216 |
+----------------------+
1 row in set (0.02 sec)
mysql> select @@secure_file_priv;
+--------------------+
| @@secure_file_priv |
+--------------------+
| NULL |
+--------------------+
1 row in set (0.01 sec)
And the FILE privilege has been granted:
Code:
mysql> show grants;
+---------------------------------------------------------------------------------------------------------------+
| Grants for board18@localhost
+---------------------------------------------------------------------------------------------------------------+
| GRANT FILE ON *.* TO 'board18'@'localhost' IDENTIFIED BY PASSWORD omitted
| GRANT ALL PRIVILEGES ON `board18`.* TO 'board18'@'localhost'
+---------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
I am at a loss as to what else to check. Any suggestions?