Tharindu ucsc
Tharindu ucsc

Reputation: 641

LOAD DATA INFILE does not import to mysql database

I have mysql table called 'master'

CREATE TABLE `master` (
  `id` int(7) NOT NULL AUTO_INCREMENT,
  `destination` varchar(30) NOT NULL,
  `bay` varchar(5) DEFAULT NULL,
  `shipInvoiceNumber` varchar(20) NOT NULL,
  `invoiceNumber` varchar(20) DEFAULT NULL,
  `start` varchar(20) NOT NULL,
  `end` varchar(20) NOT NULL,
  KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=100113 DEFAULT CHARSET=latin1;

i have write a code using LOAD DATA INFILE.

mysql_query("LOAD DATA INFILE 'master.csv' INTO TABLE master fields terminated by ',' (destination,bay,shipInvoiceNumber,invoiceNumber,start,end);"); 

my 'master.csv' file

KANDY,Bay1,2011/331,5618,60842,60855
KANDY,Bay1,2011/331,5618,62493,62493

but it didnt import data in to database table.

any issue?

Upvotes: 0

Views: 1612

Answers (1)

Andrej
Andrej

Reputation: 7504

It can be two causes without additional info about error:

  1. Mysql is remote server and you try to load file from remote server. So you use LOAD DATA LOCAL INFILE. See section with LOCAL description in http://dev.mysql.com/doc/refman/5.1/en/load-data.html
  2. You haven't got permissions to run this command

Upvotes: 1

Related Questions