Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use mysql_init and mysql_options correctly for LOAD DATA LOCAL?

Status
Not open for further replies.

phn737

Technical User
Nov 4, 2002
31
US
OK, so I have this problem with MySQL 3.23.53 (win2k) and Apache2.0.43(running as module) and PHP4.3.0(dev) (this is necessary for Apache2.0.43 to run as module; php bug). I have a script that load data from a csv file into a DB. The problem is in newer version of MySQL 'LOAD DATA LOCAL INFILE' is disable for security feature.

By adding the line below in c:\winnt\my.ini, I can use 'LOAD DATA LOCAL INFILE' from mysql client from the command prompt.
[mysql]
local-infile=1

Now I am still unable to use 'LOAD DATA LOCAL INFILE' from a php script via the webbrowser, I get this message:

The used command is not allowed with this MySQL version

MySQL online document
said to use mysql_init and mysql_options, but I can't figure it out. What is the proper syntax to add this two functions before the mysql_connect to get this working properly?

Please help.
Thank you.
 
Yes the import.txt file is uploaded to the same directory that the php script is executing from (which is on the same machine that is hosting the apache and mysql).

So you do think I need to add the 'mysql_init' and 'mysql_options' functions into my php script?
 
No, you do not have to add those functions.

Do not use the "LOCAL" keywork in your query.

You use "LOCAL" only when the data is sitting on one machine, and MySQL is running on another. It adds the functionality of passing the file to MySQL through the database connection. Want the best answers? Ask the best questions: TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top