3

如何将数据从csv文件导出到mysql数据库?有任何查询或其他方式吗?

4

2 回答 2

2

我认为您IMPORT的意思是.,方法如下:

load data local infile 'yourCSVfilepath.csv' into table tableNameHERE
fields terminated by ','
optionally enclosed by '"'
lines terminated by '\r\n'
于 2013-03-14T05:59:18.270 回答
1

要将数据从 Mysql 导出到 csv,请使用此

SELECT *
INTO OUTFILE '/tmp/tablename.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
ESCAPED BY '\\'
LINES TERMINATED BY '\n'
FROM tablename

要将 csv 导入 Mysql,请使用此

LOAD DATA INFILE 'c:/tablename.csv' INTO TABLE tablename
于 2013-03-14T06:13:31.140 回答