MySQL /phpmyadmin 无法导入 CSV
MySQL /phpmyadmin import CSV impossible
我正在尝试通过 Phpmyadmin 将 CSV 文件导入 MySQL。
我的文件是从我无法访问或控制的另一个软件导出的。
遗憾的是,文件 "export.csv" 在第一行中包含一些 "info about the other db",在第二行中它包含列名。
我正在使用以下设置:
file: import.csv
character Set of file: iso-8859-1
Skip this number of queries (for SQL) or lines (for other formats), starting from the first one : 2
format: CSV
columns separated by: ;
但我总是收到错误 "column count not matching in line: 1"。
如果我删除 csv 文件中的前两行,它就完美了。
在我看来 skip rows
不起作用。但是为什么?
您必须首先 select table 要将 CSV 文件导入到其中。您可以通过单击 table 名称来执行此操作。然后您可以单击“导入”选项卡。如果你在这个地方使用了错误的顺序,那么你将被引导到唯一的 SQL 导入功能。这仍然是“导入”选项卡,但 CSV 导入功能不会显示。
因此,请确保您看到此菜单 导入文件的格式 以及正下方的 CSV 选项。否则你必须重试才能到达这个地方。
Number of records(queries) to skip from start: 1
Format of imported file
CSV
CSV using LOAD DATA
SQL
然后你选择CSV和右边的正确选项:
Fields terminated by ;
Fields enclosed by "
Fields escaped by \
Lines terminated by auto
Column names ...
您必须复制 CSV 文件的第一行并删除“”并替换; by ,以便获得列名。您还必须在此表单中的 "Column names" 之后插入这些列名,而不是我的三个点 (...) .
例如:
Column names uid,pid,tstamp,crdate,deleted,hidden,starttime,endtime,fe_group,title,subtitle,itemnumber,price,note,image,inStock
结果会这样显示:
Import has been successfully finished, 94 queries executed.
我正在尝试通过 Phpmyadmin 将 CSV 文件导入 MySQL。 我的文件是从我无法访问或控制的另一个软件导出的。 遗憾的是,文件 "export.csv" 在第一行中包含一些 "info about the other db",在第二行中它包含列名。
我正在使用以下设置:
file: import.csv
character Set of file: iso-8859-1
Skip this number of queries (for SQL) or lines (for other formats), starting from the first one : 2
format: CSV
columns separated by: ;
但我总是收到错误 "column count not matching in line: 1"。
如果我删除 csv 文件中的前两行,它就完美了。
在我看来 skip rows
不起作用。但是为什么?
您必须首先 select table 要将 CSV 文件导入到其中。您可以通过单击 table 名称来执行此操作。然后您可以单击“导入”选项卡。如果你在这个地方使用了错误的顺序,那么你将被引导到唯一的 SQL 导入功能。这仍然是“导入”选项卡,但 CSV 导入功能不会显示。 因此,请确保您看到此菜单 导入文件的格式 以及正下方的 CSV 选项。否则你必须重试才能到达这个地方。
Number of records(queries) to skip from start: 1
Format of imported file
CSV
CSV using LOAD DATA
SQL
然后你选择CSV和右边的正确选项:
Fields terminated by ;
Fields enclosed by "
Fields escaped by \
Lines terminated by auto
Column names ...
您必须复制 CSV 文件的第一行并删除“”并替换; by ,以便获得列名。您还必须在此表单中的 "Column names" 之后插入这些列名,而不是我的三个点 (...) .
例如:
Column names uid,pid,tstamp,crdate,deleted,hidden,starttime,endtime,fe_group,title,subtitle,itemnumber,price,note,image,inStock
结果会这样显示:
Import has been successfully finished, 94 queries executed.