Questions tagged [load-data-infile]

A mySQL function for loading external data directly into the database.

LOAD DATA INFILE is a mySQL function for loading external data directly into the database.

More information available from the mySQL manual: http://dev.mysql.com/doc/refman/5.1/en/load-data.html

642 questions
7
votes
4 answers

What file and directory permissions are required for MySQL LOAD DATA INFILE?

I have a script that is trying to load some data into MySQL with LOAD DATA INFILE. For some reason, it works if the file is in the /tmp directory, but not if the file is in another directory with identical permissions. I can't find any way to get…
Tim Martin
  • 3,618
  • 6
  • 32
  • 43
7
votes
9 answers

MySQL LOAD DATA Error (Errcode: 2 - "No such file or directory")

I am trying to load data into a table of my MySQL database, and getting this error. LOAD DATA LOCAL INFILE 'C:\Users\Myself\Desktop\Blah Blah\LOAD DATA\week.txt' INTO TABLE week; Reference: this The path is hundred percent correct, I copied it by…
Solace
  • 8,612
  • 22
  • 95
  • 183
7
votes
2 answers

MySQL load data infile loading exactly half the records

I am loading a CSV file using MySQL's LOAD DATA INFILE but only half the rows load. I have tested different files and exactly half of the rows will load every time. How can I get all the rows to load? Here is the LOAD DATA INFILE SQL: LOAD DATA…
Grasshopper
  • 152
  • 1
  • 10
7
votes
2 answers

Is it possible to use a LOAD DATA INFILE type command to UPDATE rows in the db?

Pseudo table: | primary_key | first_name | last_name | date_of_birth | | 1 | John Smith | | 07/04/1982 | At the moment first_name contains a users full name for many rows. The desired outcome is to split the data, so…
cw84
  • 2,111
  • 5
  • 24
  • 37
7
votes
5 answers

LOAD DATA LOCAL INFILE fails - from php, to mysql (on Amazon rds)

We're moving our database from being on the webserver to a separate server (from an Amazon EC2 webserver to an RDS instance.) We have a LOAD DATA INFILE that worked before that is going to need the LOCAL keyword added now that the database will be…
Redzarf
  • 2,578
  • 4
  • 30
  • 40
6
votes
1 answer

How does 'LOAD DATA INFILE' work in statement-based replication?

In MySQL, using statement based replication I assume that every SQL statement gets executed on the slave exactly the same way as on the master. However, when I run the statement: LOAD DATA INFILE 'filename' INTO SomeTable; I'm not sure if the file…
Avi
  • 19,934
  • 4
  • 57
  • 70
6
votes
4 answers

MySQL LOAD DATA INFILE "not found (Errcode: 13 - Permission denied)"

Last week this was working, and today it isn't. I have not changed the php file. All I have done in the interim is run apt-get update on my Ubuntu 15.04 server. The MySQL statement I have is: LOAD DATA INFILE "/var/www/html/uploads/TitleList.csv"…
Neill
  • 71
  • 1
  • 1
  • 3
6
votes
4 answers

Parameterizing file name in MYSQL LOAD DATA INFILE

Is there a way to dynamically specify a file name in the LOAD DATA INFILE? Can it be parameterized like for instance (syntax may be incorrect) LOAD DATA INFILE '$filename'?
Ameya
  • 61
  • 1
  • 1
  • 2
6
votes
3 answers

How to import latitude/longitude data correctly into MySQL?

I've got a dataset of city names with their corresponding latitudes/longitudes that I've loaded into a MySQL table, like so: city_id | city_name | latitude DECIMAL(9,6) | longitude DECIMAL(9,6) Typical latitude/longitude coordinates might look like…
Tom
  • 30,090
  • 27
  • 90
  • 124
6
votes
3 answers

Uploading CSV into MySQL table with simultaneous JOIN

What I'm trying to do is upload a CSV into a table, while appending information from a third table to the target table using JOIN. The CSV import.csv (with 1M rows) looks like this: firstname | lastname The target table "names" looks like…
Brian Mayer
  • 989
  • 3
  • 13
  • 23
6
votes
2 answers

Maximum query length to avoid EPIPE error in node.js

I am using felixge/node-mysql module to interact with MySQL database from node.js. I have met the problem when inserting large amounts of data to database in one INSERT request. Although here there is description of how to add 500,000 records to…
zavg
  • 10,351
  • 4
  • 44
  • 67
6
votes
3 answers

Finding MySQL errors from LOAD DATA INFILE

I am running a LOAD DATA INFILE command in MySQL and one of the files is showing errors at the mysql prompt. How do I check the warnings and errors? Right now the only thing I have to go by is the fact that the prompt reports 65,535 warnings on…
Xeoncross
  • 55,620
  • 80
  • 262
  • 364
6
votes
2 answers

Minimum database privileges to use load data infile

I'm using mysqlimport to replace data in a table with values from a TSV file. Everything is working fine (importing data using the DB superuser name and password), so now I want to lock it down so that the database user doing the import can only…
5
votes
3 answers

What mysql settings affect the speed of LOAD DATA INFILE?

Let me set up the situation. We are trying to insert a modestly high number of rows (roughly 10-20M a day) into a MyISAM table that is modestly wide: +--------------+--------------+------+-----+---------+-------+ | Field | Type |…
Jason
5
votes
6 answers

How to convert date in .csv file into SQL format before mass insertion

I have a csv file with a couple thousand game dates in it, but they are all in the MM/DD/YYYY format 2/27/2011,3:05 PM,26,14 (26 and 14 are team id #s), and trying to put them into SQL like that just results in 0000-00-00 being put into the date…
cfrederich
  • 1,790
  • 6
  • 26
  • 35