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
5
votes
4 answers

MySql file import (LOAD DATA LOCAL INFILE)

I have a table called city: +------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+--------------+------+-----+---------+----------------+ | id …
Flukey
  • 6,445
  • 3
  • 46
  • 71
5
votes
1 answer

LOAD DATA LOCAL INFILE loses connection, how do I fix the timeout?

I am loading a large text file into my db through LOAD DATA. The file is about 122,000 lines long. Let alone, The db is designed to be triggered on AFTER INSERT's on that table. What happens exactly is that the query begin executing, keeps executing…
3ashmawy
  • 469
  • 1
  • 7
  • 16
5
votes
1 answer

Is there a way to populate a MySQL 5.7 table with data from a json file with line breaks on Win7?

I have following example json file and I'm trying to populate a MySQL table with it. Since MySQL 5.7 supports json as a native datatype I thought this shouldn't be a problem, but MySQL's json validator seems to have a problem with the line breaks…
user3168930
  • 81
  • 1
  • 7
5
votes
2 answers

mysqlimport issues "set @@character_set_database=binary" which prevents loading json values

I have been using mysqlimport without problems for a long time, now as mysql 5.7 added json data type support, I'm trying to use mysqlimport with rows containing json data. Here is an example of a row in csv file that will be imported using…
user1011792
5
votes
5 answers

mysql_connect with --local-infile parameter

Can not load data from uploaded (local) file since upgrade of mysql (current version: Server version: 5.5.44-0+deb8u1 (Debian)), files implied are: dbconnection.php
Andrés Chandía
  • 999
  • 1
  • 16
  • 32
5
votes
3 answers

MySQL fields terminated by tab

I am trying to upload a tab delimitted file with MySQL. I want a query something likes this: LOAD DATA LOCAL INFILE 'file' INTO TABLE tbl FIELDS TERMINATED BY 'TAB' Is there something I can subsitute for TAB to make this work?
Brian
  • 26,662
  • 52
  • 135
  • 170
5
votes
5 answers

LOAD DATA INFILE only 1 record inserted

I have a csv file that I'm trying to import via the command line. But only 1 row is being inserted. They are comma separated values. I'm on a Mac using Excel Mac. I save as a csv file. How can I tell if the lines are terminated by \r or \n or both?…
EricP
  • 1,459
  • 6
  • 33
  • 55
5
votes
4 answers

How do I import a whitespace-delimited text file into MySQL?

I need to import largish (24MB) text files into a MySQL table. Each line looks like this: 1 1 0.008 0 0 0 0 0 There are one or more spaces after each field, and the last field is tailed by about 36 spaces…
lindelof
  • 34,556
  • 31
  • 99
  • 140
5
votes
2 answers

Mysql Load Data for existing column of a table

Initially I have uploaded Using load Data Infile row is having like 100000 Im Using Ubuntu Example:data ToneCode....Artist...MovieName...Language 1....................Mj..........Null...........…
vishu
  • 77
  • 8
5
votes
1 answer

Problems with MySQL LOAD XML INFILE

I have a XML document in the format of... ]]> 1
Leke
  • 873
  • 3
  • 15
  • 28
5
votes
1 answer

Mysql select from another table in a load infile

I have a csv file that I am loading in to a mysql db using the load local infile command. The csv has a set of fields that are gathered from an enum of 5 values and I will need to query based on these. To speed up the queries (possibly up to 6…
Michael Allen
  • 5,712
  • 3
  • 38
  • 63
5
votes
2 answers

LOAD DATA INFILE with variables

I was tring to use the LOAD DATA INFILE as a sotred procedure but it seems it cannot be done. Then i tried the usual way of embedding the code to the application itself like so, conn = new MySqlConnection(connStr); conn.Open(); MySqlCommand cmd =…
Hasitha Shan
  • 2,900
  • 6
  • 42
  • 83
5
votes
6 answers

load data infile, dealing with fields with comma

How do we deal with field with comma when using load data infile? i have this query: $sql = "LOAD DATA LOCAL INFILE '{$file}' INTO TABLE sales_per_pgs FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' IGNORE 1 LINES …
Mico
  • 489
  • 4
  • 9
  • 26
4
votes
2 answers

MySQL: Loading multiple files into a table

I've been trying to load multiple files into a table, so that they would fit the same row. I can insert them separately, but then the issue lies within the NULL values, and I plan to JOIN this table. If that happens, I get too many NULL values --…
Michael
  • 107
  • 1
  • 2
  • 9
4
votes
6 answers

MySQL cannot find data file for a load operation

I would like to load a data file into MySQL using the following command: LOAD DATA LOCAL INFILE '/Users/David/Desktop/popularity20110511/test_data' INTO TABLE test_table The above command gives me the following error: #7890 - Can't find file…
David
  • 14,205
  • 20
  • 97
  • 144