将大分隔文件导入MySQL表并添加新标识符

时间:2013-12-05 22:38:22

标签: mysql database

我正在尝试将大型数据集上传到MySQL。问题是这一切都混乱了

1 个答案:

答案 0 :(得分:0)

它是这样的:

LOAD DATA [LOCAL] INFILE 'nom_fichier'
INTO TABLE nom_table
[FIELDS
    [TERMINATED BY '\t']
    [ENCLOSED BY '']
    [ESCAPED BY '\\' ]
]
[LINES 
    [STARTING BY '']    
    [TERMINATED BY '\n']
]

对于你的例子:

LOAD DATA [LOCAL] INFILE 'YourFile'
INTO TABLE TableName
[FIELDS
    [TERMINATED BY '\t']
    [ENCLOSED BY '']
    [ESCAPED BY '\\' ]//We don't need it here...
]
[LINES 
    [STARTING BY '']    
    [TERMINATED BY '\n']
]

请在此处查看:http://dev.mysql.com/doc/refman/5.1/en/load-data.html