将CSV导入到MySQL表返回错误#1148 [英] Importing CSV to MySQL table returns an error #1148

查看:1990
本文介绍了将CSV导入到MySQL表返回错误#1148的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用DirectAdmin导入,当我选择CSV而不使用LOAD DATA - 我收到错误第1行CSV输入中的字段计数无效。

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."

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

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

从MS Access数据库访问。

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

以下是前两行:

"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 "


推荐答案

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

From mysql command line pass the following parameter:

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

而不是使用: load data infile ,使用:加载数据local infile 应该执行导入。

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

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

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


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

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:

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

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

这篇关于将CSV导入到MySQL表返回错误#1148的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆