PDA

View Full Version : Not able to LOAD DATA LOCAL INFILE anymore



getmea
02-13-2008, 12:00 AM
Hi all...

My web host recently upgraded the PHP Admin system to 2.40 and mySQL to 4.0.27. And now, I am no longer able to import CSV data files into the database. The error I get is:
--------------------------------------------------------------------------------------------------------------------------
SQL-query :

LOAD DATA LOCAL INFILE '/home/vdeck/tmp/phpVHHq7g' INTO TABLE `Inventory` FIELDS TERMINATED BY ',' ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY '\r\n'

MySQL said:

The used command is not allowed with this MySQL version
--------------------------------------------------------------------------------------------------------------------------

What gives? Why would mySQL remove this feature? Anyone know how to get around this?

Very annoying...I need to import roughly 2000 records daily to run an inventory update on my site. I end up having to write scripts to write SQL Insert statements...

By the way, anyone know how to import tab-delimited text files into the same?

Thanks.

wige
02-13-2008, 09:53 AM
LOAD DATA LOCAL INFILE is a security risk. As of MySQL 4.0.2, admins and hosting companies have the option, during the install process, to disable the LOCAL operator, since use of the operator with systems such as PHP MyAdmin represents a massive security threat (has to do with the way Linux handles permissions - any file visible to the Apache server application could be read by using this command and as a result source code and password files could be revealed to unauthorized users).

getmea
02-13-2008, 11:27 AM
wige:

I rely on my supplier giving me an inventory file nightly which I read into excel and save as a CSV. Now since LOAD DATA has been turned off, I have had to convert the data into a sql "insert" scripts. Luckily, it is a file with not many columns. The updated master file, on the other hand has much more data.

Do you have any suggestions I can try to minimize data-conversion time?

thanks!

DaveSawers
02-13-2008, 07:57 PM
Write a little Excel macro to reformat the data into inserts.