LOAD DATA LOCAL INFILE失去连接,如何修复超时?

时间:2010-10-25 22:48:14

标签: mysql load-data-infile

我通过LOAD DATA将大文本文件加载到我的数据库中。该文件长约122,000行。更不用说,db被设计为在该表上的AFTER INSERT上触发。确切的是,查询开始执行,持续执行15-20分钟,然后返回

Error Code: 2013
Lost connection to MySQL server during query

然后

Error Code: 2006
MySQL server has gone away

出现错误后,我重新执行查询并立即完成;

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

表格确实已导入;

select * from quote
122574 row(s) returned

我在Mac OS X 10.6.4上运行mysqld 5.1.51,我的查询是

    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';

似乎db-connection正在超时,我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

您可以在启动mysqld时通过设置wait_timeout变量来更改时间限制。请参阅MySQL documentation