如何纠正MySQL加载错误 [英] How can I correct MySQL Load Error
问题描述
我不太确定一个类似的问题,这是关闭,我试图执行以下MySQL程序。
mysql -e加载数据本地infile \
'/tmp/ept_inventory_wasp_export_04292013.csv'到\
表wasp_ept_inv字段由','\
终止的行以'\\\
'结尾;
并收到此错误
错误1148(42000)在第1行:此MySQL版本不允许使用的命令
我如何解决这个问题?
我实际上是从一个Python程序运行这个命令,但是拉出命令,试图在bash命令行处理它。
我已经看到了如何修改my.cnf(local-infile),但是如果我可以避免的话,我不希望全局变化。
这里是MySQL版本。
mysql版本14.14 Distrib 5.5.31,对于debian-linux-gnu(i686)使用readline 6.2
为了解决这些问题,我们改变了
LOAD DATA LOCAL
处理为MySQL 3.23.49和MySQL 4.0.2(Windows上的4.0.13):
默认情况下,所有MySQL客户端和二进制发行版本库都使用
- enable-local-infile
选项,以与MySQL 3.23.48和之前兼容。
如果从源代码构建MySQL但不调用configure, code> - enable-local-infile 选项,
LOAD DATA LOCAL
无法由任何客户端使用,除非它被明确地写入以调用mysql_options(... MYSQL_OPT_LOCAL_INFILE,0)
。请参见第20.6.6.49节mysql_options()
。
您可以停用
LOAD DATA LOCAL
语句从服务器端启动 mysqld 与- local-infile = 0
选项。
对于 mysql 命令行客户端,请启用
LOAD DATA LOCAL
,指定- local-infile [= 1]
选项,或使用- local-infile = 0
选项。对于 mysqlimport ,默认情况下,本地数据文件加载已关闭;使用- 本地
或-L
选项。在任何情况下,成功使用本地加载操作都需要服务器允许它。
[client]
loose-local-infile = 1
/ li>
如果
LOAD DATA LOCAL
在服务器或客户端中被禁用,尝试发出此类语句的客户端会收到以下错误消息:
错误1148:此MySQL版本不允许使用的命令
I'm not quite sure a similar question to this was closed by I'm trying to execute the following MySQL program.
mysql -e "load data local infile \
'/tmp/ept_inventory_wasp_export_04292013.csv' into \
table wasp_ept_inv fields terminated by ',' \
lines terminated by '\n' ;"
at the bash command line and get this error
ERROR 1148 (42000) at line 1: The used command is not allowed with this MySQL version
How can I work around this problem?
I am actually running this command from a Python program, but pulled the command out to try fiddling with it at the bash command line.
I've seen how I can modify my.cnf (local-infile), but I do not want that global a change if I can avoid it.
Here's the MySQL version.
mysql Ver 14.14 Distrib 5.5.31, for debian-linux-gnu (i686) using readline 6.2
As documented under Security Issues with LOAD DATA LOCAL
:
To deal with these problems, we changed how
LOAD DATA LOCAL
is handled as of MySQL 3.23.49 and MySQL 4.0.2 (4.0.13 on Windows):
By default, all MySQL clients and libraries in binary distributions are compiled with the
--enable-local-infile
option, to be compatible with MySQL 3.23.48 and before.If you build MySQL from source but do not invoke configure with the
--enable-local-infile
option,LOAD DATA LOCAL
cannot be used by any client unless it is written explicitly to invokemysql_options(... MYSQL_OPT_LOCAL_INFILE, 0)
. See Section 20.6.6.49, "mysql_options()
".You can disable all
LOAD DATA LOCAL
statements from the server side by starting mysqld with the--local-infile=0
option.For the mysql command-line client, enable
LOAD DATA LOCAL
by specifying the--local-infile[=1]
option, or disable it with the--local-infile=0
option. For mysqlimport, local data file loading is off by default; enable it with the--local
or-L
option. In any case, successful use of a local load operation requires that the server permits it.If you use
LOAD DATA LOCAL
in Perl scripts or other programs that read the[client]
group from option files, you can add thelocal-infile=1
option to that group. However, to keep this from causing problems for programs that do not understandlocal-infile
, specify it using theloose-
prefix:[client] loose-local-infile=1If
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
这篇关于如何纠正MySQL加载错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!