开发者

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 for like 15-20 mins and then it returns

Error Code: 2013
Lost connection to MySQL server during query

then

Error Code: 2006
MySQL server has gone away

After the errors appear , i re-execute the query and it finishes immediately ;

0 row(s) affected
Records: 122574  Deleted: 0  Skipped: 122574  Warnings: 0

And the table is indeed imported ;

select * from quote
122574 row(s) returned

I am running mysqld 5.1.51 on Mac OS X 10.6.4 and my query is

    LOAD data local INFILE 
        '/Users/ash/quotes/data.txt' 
        INTO TABLE quote fields 
        TERMINATED BY ',' ENCLOSED BY '' LINES TERMINATED BY '\r\n' 
          (quote.date,quote.ticker,quote.open,
           quote.high,quote.low,quote.close,quote.开发者_开发知识库volume,@market) 
          SET market = 'sp';

It seems the db-connection is timing out, how do I fix this?


You can change the time limit by setting the wait_timeout variable when you start mysqld. Refer MySQL documentation

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜