mysqlimport-在MS Windows XAMPP环境中导入CSV文件 [英] mysqlimport - Import CSV File in MS Windows XAMPP emvironment
本文介绍了mysqlimport-在MS Windows XAMPP环境中导入CSV文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试从命令行将CSV文件导入到mysql数据库.稍后将其合并到Windows批处理文件中.
I am trying to import a CSV file from to a mysql database from the command line. This will be later incorporated into a Windows batch file.
mysqlimport -u user -puserpw --columns=ID,CID,Alerted --fields-terminated-by=',' --local School Customer.csv
所有数据都加载到客户"表的第一列中. 我想将数据从CSV正确导入到适当的列.
All the data loads into the first column in the Customer table. I want to correctly import data from the CSV to the appropriate column.
CSV数据格式:
ID,CID,Alerted
1,CS,N
2,CS,N
3,CS,N
我想使用mysqlimport,因为这将更容易添加到Windows批处理文件中. 我该怎么办,请帮忙?
I would like to use mysqlimport since this will be easier to add to a Windows batch file. How can I do this please help?
推荐答案
我必须将值括在双引号"
I had to enclose the values in double quotes "
mysqlimport -u user -puserpw --columns=ID,CID,Alerted --ignore-lines=1 --fields-terminated-by="," --lines-terminated-by="\n" --local School Customer.csv
解决了这个问题.
这篇关于mysqlimport-在MS Windows XAMPP环境中导入CSV文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文