LOAD_FILE() only works on Windows, not Linux
I regularly import files from the file system to mysql databases using the LOAD_FILE() function. It works fine on Windows, but when I tried to do the same on Linux no data is read. File paths seems to be valid, permissions ok, backslashes on win file paths and forward slashes in linux filpaths, but only Windows behave as expected.
Win:
mysql> CREATE TABLE files (
-> `filepath` varchar(200) NOT NULL, -- path to file in local filesystem
-> `html` longtext -- a text field to store data
-> ) ;
Query OK, 0 rows affected (0.05 sec)
mysql>
mysql> INSERT INTO `files` (`filepath`, `html`) VALUES
-> ('C:\\temp\\somefile.html', NULL);
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> UPDATE files
-> SET html=LOAD_FILE(filepath)
-> ;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
LINUX
me@my-laptop:~$ chmod 777 somefile.html
me@my-laptop:~$ ls -l
...
-rwxrwxrwx 1 me me 21 2008-07-14 00:46 somefile.html
mysql> CREATE TABLE files (
-> `filepath` varchar(200) NOT NULL,
-> `html` longtext
-> ) ;
Query OK, 0 rows affected (0.00 sec)
mysql> INSERT INTO `files` (`filepath`, `html`) VALUES
-> ('~/somefile.html', NULL),
-> ('/home/myusername/somefile.html', NULL)
-> ;
Query OK, 2 rows affected (0.00 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql>
mysql> UPDATE files
-> SET html=LOAD_FILE(filepath) ;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 2 Changed: 0 Warnings: 0
mysql>
No data imported to the column html :-(
What's wrong here? Mysql or Linux (Ubuntu) ?