如何将CSV数据导入MySQL

2024-12-23 02:00:52
推荐回答(1个)
回答1:

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