LOAD DATA LOCAL INFILE给出错误使用此命令不允许与此MySQL版本 [英] LOAD DATA LOCAL INFILE gives the error The used command is not allowed with this MySQL version

查看:270
本文介绍了LOAD DATA LOCAL INFILE给出错误使用此命令不允许与此MySQL版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个PHP脚本调用MySQL的 LOAD DATA INFILE 从CSV文件加载数据。但是,在生产服务器上,我最终出现以下错误:

I have a PHP script that calls MySQL's LOAD DATA INFILE to load data from CSV files. However, on production server, I ended up with the following error:


访问被拒绝用户...(使用密码:是) / p>

Access denied for user ... (using password: yes)

作为一个快速解决方法,我将命令更改为 LOAD DATA LOCAL INFILE 工作。但是,同一个命令在客户端服务器上失败,并显示以下消息:

As a quick workaround, I changed the command to LOAD DATA LOCAL INFILE which worked. However, the same command failed on client's server with this message:


此MySQL版本不允许使用此命令

The used command is not allowed with this MySQL version

我假设这与服务器变量有关:local_infile = off 在这里

I assume this has something to do with the server variable: local_infile = off as described here.

请建议一个不涉及更改服务器设置的解决方法。注意,安装在同一服务器上的phpMyAdmin实用程序似乎接受CSV文件,虽然我不确定它使用 LOAD DATA(LOCAL)INFILE

Please suggest a workaround that does not involve changing server settings. Note that phpMyAdmin utility installed on the same server appears to accept CSV files though I am not sure it it uses LOAD DATA (LOCAL) INFILE.

推荐答案

与root进入相同的问题,并引发我一会儿

Ran into the same issue as root and threw me for a moment

您的服务器设置通过compile

could be an issue with your server settings set with compile

设置,以使用相同的用户测试登录到控制台并尝试您的加载数据命令

to test login to console with the same user and try your load data command

如果您得到相同的错误,请尝试关闭控制台并运行

if you get the same error, try closing console and running

mysql -u USER -p --local-infile=1 DATABASE

现在尝试再次运行load data命令

now try running load data command again

如果它的工作,那么你将需要重新启动mysqld命令行选项或重新安装配置选项

if it works then you're going to need to restart mysqld with command line option or re-install with configuration option

引用(参考为5.0,但工作me with 5.5):

references (references are for 5.0 but worked for me with 5.5):

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

http://dev.mysql.com/doc/refman/5.0/en/ mysql-command-options.html#option_mysql_local- infile

这篇关于LOAD DATA LOCAL INFILE给出错误使用此命令不允许与此MySQL版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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