我使用以下代码将 csv 从 Windows Excel 上传到 mysql 数据库。
load data infile 'C:\\Users/path/Desktop/name.csv' into Table tablename
fields terminated by ','
lines terminated by '/r/n'
ignore 1 rows
;
当我运行代码时,我得到结果:
Query OK, 0 rows affected(0.01 sec)
Records: 0 Deleted: 0 Skipped: 0 Warnings: 0
这是我第一次使用 mysql,很抱歉这个非常简单的问题。
最佳答案
我需要将本地添加到文件中,因此最终看起来像
load data local infile 'C:path.csv' into Table tablename
fields terminated by ','
lines terminated by ';'
ignore 1 rows
;
关于导入中受影响的 MYSQL 0 行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29723811/