LOAD DATA LOCAL INFILE gives the error The used command is not allowed with this MySQL version

Ran into the same issue as root and threw me for a moment

could be an issue with your server settings set with compile

to test login to console with the same user and try your load data command

if you get the same error, try closing console and running

mysql -u USER -p --local-infile=1 DATABASE

now try running load data command again

if it works then you're going to need to restart mysqld with command line option or re-install with configuration option

references (references are for 5.0 but worked for me with 5.5):

http://dev.mysql.com/doc/refman/5.0/en/load-data-local.html

http://dev.mysql.com/doc/refman/5.0/en/mysql-command-options.html#option_mysql_local-infile


I found that I need to connect to database like this:

$dbh=mysql_connect($server,$dbuser,$dbpass,false,128);

Passing 128 in the flags parameter is the key.

See http://www.php.net/manual/en/mysql.constants.php#mysql.client-flags to read more about the flags.