Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the file located in Load Data Infile?

Tags:

php

mysql

If I use a Load Data Infile MySQL query in PHP, where is the file location relative to? Is it the same folder as the PHP file?

like image 246
Brian Avatar asked Feb 08 '10 11:02

Brian


People also ask

What is load data infile?

The LOAD DATA INFILE statement reads rows from a text file into a table at a very high speed. If the LOCAL keyword is specified, the file is read from the client host. If LOCAL is not specified, the file must be located on the server.

How do I find my local Infile in MySQL?

In case if Mysql 5.7 you can use "show global variables like "local_infile" ;" which will give the local infile status ,You can turn it on using "set global local_infile=ON ; ". Show activity on this post.

What is load data in MySQL?

Using the LOAD DATA statement, you can insert the contents of a file (from the server or a host) into a MySQL table. If you use the LOCAL clause, you can upload the local files contents int to a table.

Which statement can you use to load data from a file into a table load data infile cat file MySQL extended insert statement load data local infile?

Using the LOCAL modifier with the LOAD DATA INFILE statement, you can import file from the client (local computer) to a remote MySQL database server. Here, the client program reads the file present on the client and sends it to the desired remote MySQL Database Server.


1 Answers

With LOAD DATA INFILE, the file name is relative to the server.

With LOAD DATA LOCAL INFILE, the file is relative to the client.

If both server and client reside on the same machine, you shold use LOAD DATA INFILE, because it can handle key violations and other errors much more nicely.

like image 107
Quassnoi Avatar answered Sep 27 '22 18:09

Quassnoi