Skip to content

Instantly share code, notes, and snippets.

@ayonliu
Last active February 28, 2018 08:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayonliu/08c1d82afd055a97319e2e33239709f5 to your computer and use it in GitHub Desktop.
Save ayonliu/08c1d82afd055a97319e2e33239709f5 to your computer and use it in GitHub Desktop.
mysql 的一些参考

The LOAD DATA INFILE statement reads rows from a text file into a table at a very high speed.

LOAD DATA LOCAL INFILE '/tmp/merchant.log' 
REPLACE INTO TABLE `log` 
FIELDS TERMINATED BY ',' 
OPTIONALLY ENCLOSED BY '"' 
LINES TERMINATED BY '\n' 
(date,merchant,landing_page,source_keyword,type,inclicking,revenue,order_count,sales,site,update_time) 

/tmp/merchant.log 内容如下:

2017-10-29,dailydeals.html,/dailydeals.html,google_keyword,sem,2,0.00,0,0,uk,2018-02-28 15:40:48
2017-10-29,free-delivery-codes/,/free-delivery-codes/,google_keyword,sem,28,8.94,2,156.6062,uk,2018-02-28 15:40:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment