开发者

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 开发者_StackOverflow社区`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?


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜