|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28631 mysql load data query
Submitted: 2004-06-04 15:59 UTC Modified: 2004-06-13 01:00 UTC
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: g dot m dot seed at hw dot ac dot uk Assigned:
Status: No Feedback Package: MySQL related
PHP Version: 4.3.4 OS: Windows98
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: g dot m dot seed at hw dot ac dot uk
New email:
PHP Version: OS:


 [2004-06-04 15:59 UTC] g dot m dot seed at hw dot ac dot uk
The "load data" with "local infile" is supported in MySQL4, and has been since version 3.22. However, when an SQL query is submitted using mysql_query() the error returned by mysql_error() states "The used command is not allowed with this MySQL version"?

I have read through the php manual, mysql manual, php's bug search facilities and checked a mailing group and can't find any reference that states the "load data" command is not supported when using php4 and mysql4?

Incidentally, the query executes as expected if run at the mysql> command line prompt.

Comments on rebported bug #7244 state:

"LOAD DATA INFILE (without LOCAL) seems to be ok."

and it appears that the use of "local" is the problem. If so, then this is contrary to the MySQL manual which clearly states the use of "local".

Furthermore, if you don't consider the omission of "local" to be a bug then it should be documented since it is extremely difficult to pin this one down.

Reproduce code:
$sqlQuery = "load data local infile 'filename.csv' into table exams fields terminated by ',' enclosed by '\"' lines terminated by '\\r\\n'";

$result = mysql_query($sqlQuery)
	or die("query failed, error=" .  mysql_error() . "\n");

Expected result:
To insert the data from filename.csv

Actual result:
query failed, error=The used command is not allowed with this MySQL version 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-04 17:27 UTC]
Do you have safe_mode or open_basedir enabled? 
 [2004-06-13 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2022-10-29 02:27 UTC] Elise at harley-davidson dot com
The issue mysql load data query has been fixed. Thanks. Please visit this site to have a look at our Harley Davidson at (
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Jan 31 23:03:42 2023 UTC