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
3
votes
1 answer

Load data local infile with IF statement

I have table with data: | id | status | +-----+--------+ | 1 | 1 | | 2 | 1 | | 3 | 0 | | 4 | 2 | | 5 | 2 | I have file, that I need to load into this table and replace: | id | status | +----+--------+ | 1…
RexHunt
  • 192
  • 3
  • 16
3
votes
1 answer

MariaDB: LOAD DATA INFILE with dynamic_columns

I have a table that looks like this (using MariaDB): CREATE TABLE table1 ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,c_id varchar(40) NULL ,email varchar(150) NULL ,dynamic_columns BLOB NULL ,created_at TIMESTAMP NOT NULL…
Bob
  • 209
  • 2
  • 11
3
votes
1 answer

wpdb 'load data file'

I'm using the wpdb class to run a LOAD DATA LOCAL INFILE. It works fine and the data is inserted properly - but it still returns 0, so echos 'No Update' in the example. Is this the expected outcome based on the LOAD DATA method? If so, is there…
3
votes
1 answer

mysql load data infile through php script - not working

I am trying to use the mysql LOAD DATA LOCAL INFILE to get some csv data into my mysql database through a php script using mysqli. This is what my sql string looks like: LOAD DATA LOCAL INFILE '/var/www/html/dashmaker/uploads/HHdata.csv' INTO TABLE…
Andre Ling
  • 103
  • 1
  • 2
  • 14
3
votes
0 answers

LOAD DATA INFILE with a SELECT statement

I have the following database relationship: I also have this large CSV file that I want to insert into bmt_transcripts: Ensembl Gene ID Ensembl Transcript ID ENSG00000261657 ENST00000566782 ENSG00000261657 ENST00000562780 ENSG00000261657…
Migwell
  • 18,631
  • 21
  • 91
  • 160
3
votes
1 answer

LOAD DATA LOCAL INFILE large file?

I'm importing .CSV files into mySQL using LOAD DATA LOCAL INFILE, and it's working for all my test files (which are relativity small). The problem occurs when I try using the real file I want to work with, which is 97MB in size. Is there a limit to…
user3350593
3
votes
2 answers

Why can't I use LOAD DATA LOCAL with PDO even though I can from cli client?

I recently upgraded my Ubuntu 10.04 dev server to 14.04. It is actually a fresh install. PHP version was 5.4.15, and is now PHP 5.5.9. MySQL went from 5.1.67 to 5.5.37. I am trying to LOAD LOCAL DATA INFILE on a new server. It works running the…
jay.m.martin
  • 163
  • 1
  • 7
3
votes
2 answers

How to reseed an "Auto increment" column for InnoDB engine database?

I am using an artificial primary key for a table. The table had two columns, one is the primary key and the other one is a Dates (datatype: Date) column. When I tried to load bulk data from a file (which contained values for the second column only),…
Solace
  • 8,612
  • 22
  • 95
  • 183
3
votes
1 answer

replace row if the same primary key

table name: mysample. table columns: id - PK, names - pk, age. inside mysample: id names age 1 Nicole 19 2 Sam 20 3 Mark 15 I'm using MySQL Workbench. That is the result after I use this query: load…
nicole101
  • 187
  • 3
  • 20
3
votes
2 answers

Bash Script for Load Data Infile MySQL

So i'm trying to create a script that I can run that will do a batch import of csv files into a table. I'm having trouble getting the script to work. Here is the script i'm running: #!/bin/bash for f in *.csv do "/opt/lampp/bin/mysql -e use test -e…
XFerrariX
  • 47
  • 1
  • 1
  • 6
3
votes
2 answers

LOAD DATA INFILE error 1064

I am running this MySQL command: LOAD DATA LOCAL INFILE 'books.csv' INTO TABLE BOOK (Book_id, @dummy, Title, Publisher_name, @dummy, @dummy) FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n' IGNORE 1 LINES; I am getting an error: ERROR 1064…
pk10
  • 433
  • 3
  • 9
  • 20
3
votes
2 answers

Load Data Infile + Disable/Enable Keys Performance

I have a table with approximately 7 million rows. Once a day, I need to bulk import around 200,000 new rows into this table. To do this, I am first disabling keys on the table, using LOAD DATA INFILE, and then re-enabling keys on the table. The…
Steven Musumeche
  • 2,886
  • 5
  • 33
  • 55
3
votes
1 answer

MySQL Load Data Infile - Nulls causing error 1265: Data Truncated

I am having a problem importing data from csv into a MySQL table. I am attempting to use "Load Data Infile" but every time I attempt to run my code I get "Error Code: 1265. Data Truncated for column 'DIP20' at row 237" The problem stems from the…
Smoggie Tom
  • 306
  • 4
  • 12
3
votes
0 answers

In PHP, is there a way to check whether MySQL has 'LOAD DATA INFILE' enabled or disabled

I have a csv file that needs to be imported to MySQL. Initially I settled with MySQL's built-in 'LOAD DATA LOCAL INFILE' statement to import the CSV file. For some good reasons the usage of this statement is disabled on our server. Reasons As my…
Abhishek Madhani
  • 1,155
  • 4
  • 16
  • 26
3
votes
1 answer

LOAD DATA INFILE into Single Field on MySQL

I am very much a noob at MySQL.. I need to populate one field with a .txt file. My script currently reads: LOAD DATA INFILE '/attachments/file.txt' into table files (data); However, when I run the query, MySQL shows that I have updated not just one…
David Wright
  • 425
  • 3
  • 8
  • 16