将 CSV 导入 MySQL 表返回错误 #1148

发布于 2024-10-19 23:38:52 字数 1156 浏览 4 评论 0原文

我尝试使用 DirectAdmin 导入,但在不使用 LOAD DATA 的情况下选择 CSV 时 - 我收到错误“第 1 行 CSV 输入中的字段计数无效”。

当我尝试使用 LOAD DATA 时,出现以下错误:“#1148 - 此 MySQL 版本不允许使用该命令。”

CSV 是在 MS Access 中从 MS Access 数据库创建的。

这是前 2 行:

"product_id","vendor_id"," product_parent_id","product_sku","product_s_desc ","product_desc","product_thumb_image ","product_full_image","product_publish","product_weight","product_weight_uom ","product_length ","product_width","product_height ","product_lwh_uom ","disp_order","price","sale","product_url ","product_in_stock","product_available_date","product_availability ","product_special ","product_discount_id ","ship_code_id ","cdate ","mdate ","product_name ","product_sales ","attribute ","custom_attribute ","product_tax_id ","product_unit ","product_packaging ","child_options ","quantity_options ","child_option_ids ","product_order_levels "
41,2,0,1,,,"resized/Krug-Rose-Champagne-lg.jpg","Krug-Rose-Champagne-lg.jpg","Y","750.0000","grams","4.0000","4.0000",14,,14,3516,0,,,1296518400,,"N",0,"NULL ",1296574622,1297953843,"קרוג רוזה",0,,,2,"piece ",65537,"N,N,N,N,N,Y,20%,10%, ","none,0,0,1 ",,"0,0 "

I am trying to import with DirectAdmin, when I selected CSV without using LOAD DATA - I got the error "Invalid field count in CSV input on line 1."

When I tried with LOAD DATA I got the following error: "#1148 - The used command is not allowed with this MySQL version."

The CSV was created in MS Access from MS Access database.

Here are the first 2 rows:

"product_id","vendor_id"," product_parent_id","product_sku","product_s_desc ","product_desc","product_thumb_image ","product_full_image","product_publish","product_weight","product_weight_uom ","product_length ","product_width","product_height ","product_lwh_uom ","disp_order","price","sale","product_url ","product_in_stock","product_available_date","product_availability ","product_special ","product_discount_id ","ship_code_id ","cdate ","mdate ","product_name ","product_sales ","attribute ","custom_attribute ","product_tax_id ","product_unit ","product_packaging ","child_options ","quantity_options ","child_option_ids ","product_order_levels "
41,2,0,1,,,"resized/Krug-Rose-Champagne-lg.jpg","Krug-Rose-Champagne-lg.jpg","Y","750.0000","grams","4.0000","4.0000",14,,14,3516,0,,,1296518400,,"N",0,"NULL ",1296574622,1297953843,"קרוג רוזה",0,,,2,"piece ",65537,"N,N,N,N,N,Y,20%,10%, ","none,0,0,1 ",,"0,0 "

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浴红衣 2024-10-26 23:38:52

从 mysql 命令行传递以下参数:

mysql -u username -p dbname --local-infile

不要使用:load data infile,而是使用:load data local infile,它应该执行导入。

默认情况下,mysql 不会根据此处定义的安全问题启用本地加载数据

http://dev.mysql.com/doc/refman/5.0/en/load-data-local.html

如果在服务器或客户端中禁用了 LOAD DATA LOCAL,
尝试发出此类声明的客户端会收到以下信息
错误消息:

错误1148:此 MySQL 版本不允许使用的命令

From mysql command line pass the following parameter:

mysql -u username -p dbname --local-infile

Instead of using: load data infile, use: load data local infile and it should perform the import.

By default, mysql does not enable load data local as per the the security concerns defined here:

http://dev.mysql.com/doc/refman/5.0/en/load-data-local.html

If LOAD DATA LOCAL is disabled, either in the server or the client, a
client that attempts to issue such a statement receives the following
error message:

ERROR 1148: The used command is not allowed with this MySQL version

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文