如何将csv导入mysql和mysql导出csv
发布网友
发布时间:2022-04-21 23:47
我来回答
共1个回答
热心网友
时间:2022-04-08 04:09
先将它们都转换成一种中间数据格式csv(execl数据可以直接导出为csv格式,csv格式也可以直接用excel打开)。下面介绍一下操作步骤:
csv导入mysql
load data infile 'C:\\Users\\UserName\\Desktop\\test.csv'
into table `table`
fields terminated by ',' optionally enclosed by '"' escaped by '"'
lines terminated by '\n';
mysql导入csv
select * from `table`
load data infile 'C:\\Users\\UserName\\Desktop\\test.csv'
fields terminated by ',' optionally enclosed by '"' escaped by '"'
lines terminated by '\n';
如果乱码,可用相关编辑器打开.csv文件,另存为utf-8的csv