[debian-mysql] Fwd: #38403 [Com]: LOAD_FILE() function works as expected only on Windows

Harald Groven harald at groven.no
Wed Aug 27 09:06:45 UTC 2008


I filed a bug report regarding how Mysql 5.1.24 handles the LOAD_FILE
function. So far, I have only been able to reproduce it on Debian, so
I need to sort out if its the bug is related to Mysql, Debian or only
to my own LAMP-stack settings:

Can anyone test to see if they can reproduce this error?

http://bugs.mysql.com/bug.php?id=38403

Using utf8/utf8_danish_ci as collation/character set.

Harald Groven
University of Tromsø



---------- Forwarded message ----------
From: Bug Database <do-not-reply at mysql.com>
Date: 2008/8/18
Subject: #38403 [Com]: LOAD_FILE() function works as expected only on Windows
To: harald at groven.no


ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at
http://bugs.mysql.com/?id=38403&edit=2

 User updated by: Harald Groven
 Reported by:     Harald Groven
 Category:        Server: General
 Severity:        S3 (Non-critical)
 Status:          Can't repeat
 Version:         5.1.24-rc-1
 OS:              Linux
 OS Details:      Ubuntu 8
 Tags:            loadfile, import, fileimport, file

[18 Aug 15:34] Harald Groven

it's not the FILE privilege, since I'm root...

------------------------------------------------------------------------

[18 Aug 15:05] nils petersohn

The caller of this function must have the MySQL FILE privilege !

------------------------------------------------------------------------

[31 Jul 9:26] Harald Groven

harald at harald-laptop:~$ cd /
harald at harald-laptop:/$ ls -l grep test.txt
-rwxrwxrwx 1 root root 9 2008-07-31 09:14 test.txt
harald at harald-laptop:/$ cat test.txt
Hi Mysql
harald at harald-laptop:/$ mysql -uroot -p -Dtest
Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 226045
Server version: 5.1.24-rc-1 (Debian)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> SELECT LOAD_FILE('/test.txt') ;
ERROR 1300 (HY000): Invalid utf8 character string: '�LOAD_FILE'
mysql> SELECT CONVERT(LOAD_FILE('/test.txt') USING utf8) ;
+--------------------------------------------+
| CONVERT(LOAD_FILE('/test.txt') USING utf8) |
+--------------------------------------------+
| NULL                                       |
+--------------------------------------------+
1 row in set (0,09 sec)


mysql> SELECT LOAD_FILE('/test.txt') ;
+------------------------+
| LOAD_FILE('/test.txt') |
+------------------------+
| NULL                   |
+------------------------+
1 row in set (0,00 sec)

mysql>

------------------------------------------------------------------------

[31 Jul 7:09] Valeriy Kravchuk

Please, send the results of:

cat /test.txt

and

SELECT LOAD_FILE('/home/harald/test.txt');

------------------------------------------------------------------------

[30 Jul 12:54] Harald Groven

Created a file, test.txt with some ASCII text. First, move to / and make
777 to check if it is a directory/permissions problem:

harald at harald-laptop:~$ sudo cp /home/harald/test.txt /test.txt
harald at harald-laptop:~$ sudo chmod 777 /test.txt
harald at harald-laptop:~$ mysql -uroot -p -Dtest
Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 18043
Server version: 5.1.24-rc-1 (Debian)

mysql> SELECT LOAD_FILE('/test.txt');
+------------------------+
| LOAD_FILE('/test.txt') |
+------------------------+
| NULL                   |
+------------------------+
1 row in set (0,00 sec)

mysql> SELECT version();
+-------------+
| version()   |
+-------------+
| 5.1.24-rc-1 |
+-------------+
1 row in set (0,00 sec)

mysql>

------------------------------------------------------------------------

[29 Jul 16:43] Valeriy Kravchuk

Same machine, same file, recent 5.1:

openxs at suse:/home2/openxs/dbs/5.1> bin/mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.28-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select load_file('/home/openxs/.bashrc')\G
*************************** 1. row ***************************
load_file('/home/openxs/.bashrc'): # Sample .bashrc for SuSE Linux
# Copyright (c) SuSE GmbH Nuernberg
...

#export PILOTPORT=/dev/pilot
#export PILOTRATE=115200

test -s ~/.alias && . ~/.alias || true

1 row in set (0.04 sec)

mysql>


------------------------------------------------------------------------

Earlier comments can be viewed at http://bugs.mysql.com/38403


--
http://bugs.mysql.com/38403




-- 
Harald Groven
web: www.groven.no/harald
mail/msn harald at groven.no
skype: haraldgroven
phone: (+47) 905 18 625


More information about the pkg-mysql-maint mailing list