简体   繁体   English

PHPMyAdmin说:此MySQL版本不允许使用used命令

[英]PHPMyAdmin saying: The used command is not allowed with this MySQL version

I am an Java developer new to MySQL. 我是MySQL新手的Java开发人员。

I want to perform Load data operation using PHPMyAdmin. 我想使用PHPMyAdmin执行加载数据操作。 Load data scripts are verified as it worked pretty well on my Windows OS configuration.While trying to load data from CSV, i am getting : 验证加载数据脚本,因为它在我的Windows操作系统配置上运行良好。在尝试从CSV加载数据时,我得到:

The used command is not allowed with this MySQL version 此MySQL版本不允许使用used命令

Version details is as follows 版本详情如下

Mysql Server version: 5.5.34-0 Mysql Server版本: 5.5.34-0

OS : ubuntu0.13.04.1 (Ubuntu) 操作系统: ubuntu0.13.04.1(Ubuntu)

I am done with editing the my.cnf as follows: 我完成了如下编辑my.cnf

[mysql]
local-infile    =1
#no-auto-rehash # faster start of mysql but no tab completition
.......................

[mysqld]
#
# * Basic Settings
#
local-infile    =1
user        = mysql
.........................

[client] 
loose-local-infile=1
root
port        = 3306
.........................

I have tried restarting apache and mysql multiple times using - sudo service mysql restart sudo service apache2 restart 我已经尝试多次重启apache和mysql - sudo service mysql restart sudo service apache2 restart

Nothing worked for me that help me to perform the operation using phpmyadmin. 对我来说没有任何帮助我使用phpmyadmin执行操作的功能。 While using below command 使用下面的命令

mysql -u root -p --local-infile test

I am able to perform the Load data operation successfully through mysql prompt. 我能够通过mysql提示成功执行加载数据操作。 Since i have multiple CSV in chunks and SQL load scripts for each chunk so i want to run it as a whole(load scripts seprated by $) in one go using phpmyadmin. 由于我在块中有多个CSV并且每个块都有SQL加载脚本,因此我想使用phpmyadmin一次性运行它(由$分别加载脚本)。

Please help me to solve this problem. 请帮我解决这个问题。 I have already gone through below answers on stack overflow 关于堆栈溢出,我已经通过了以下答案

  1. ERROR 1148: The used command is not allowed with this MySQL version 错误1148:此MySQL版本不允许使用used命令

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

[UPDATE] [UPDATE]

Variable local_infile is showing as 'ON', I have verified this using SQL query on phpmyadmin 变量local_infile显示为“ON”,我已经在phpmyadmin上使用SQL查询验证了这一点

SHOW VARIABLES LIKE "local%"

Load script 加载脚本

LOAD DATA LOCAL INFILE 'full_dir_path/man_final.csv'
INTO TABLE `manufact_t` 
FIELDS TERMINATED BY ',' 
ENCLOSED BY '"' 
ESCAPED BY '\\' 
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES
(man_sr,man_name, address, phone, fax, email, url,subdivision, @man_parent, man_id)
set man_parent=0;

my friend. 我的朋友。 There can be few reasons of this error. 这个错误的原因很少。

  1. php.ini has wrong value for mysql.allow_local_infile . php.inimysql.allow_local_infile值不正确 Must be - mysql.allow_local_infile = On 必须是 - mysql.allow_local_infile = On

  2. If you are working locally you can try to remove the LOCAL from your SQL query . 如果您在本地工作,可以尝试从SQL查询中删除LOCAL Maybe MySQL server settings just don't allow you to use the LOCAL keyword 也许MySQL服务器设置不允许您使用LOCAL关键字

  3. Only if you use cPanel : The problem is the phpMyAdmin that is built into the cPanel interface doesn't use the php built with apache. 只有你使用cPanel :问题是内置到cPanel接口的phpMyAdmin不使用用apache构建的php。 So you can rebuild apache all day long and it will not change how php is compiled [from cPanel forum] 所以你可以整天重建apache并且它不会改变php的编译方式[来自cPanel论坛]

Hope this will help you. 希望这会帮助你。

My friend, 我的朋友,

kindly us the following steps:- 请帮助我们以下步骤: -

  1. Firstly, remove any current installations of MySQL server 首先,删除当前安装的MySQL服务器

  2. run command in terminal sudo apt-get --purge remove mysql-server 在终端sudo中运行命令apt-get --purge删除mysql-server

  3. go ahead and obtain the source files and other packages required to compile and install the source. 继续获取编译和安装源所需的源文件和其他包。

  4. run command sudo apt-get install mysql-source-5.5 build-essential libncurses5-dev cmake 运行命令sudo apt-get install mysql-source-5.5 build-essential libncurses5-dev cmake

5.Go to the directory where the source is. 5.转到源所在的目录。

The best part while installing from source is that you may configure as per your need like DENABLED_LOCAL_INFILE 从源代码安装时最好的部分是您可以根据需要配置DENABLED_LOCAL_INFILE

Kindly follow below link:- 请点击以下链接: -

http://www.sudo-juice.com/install-mysql-5-5-from-source-ubuntu-linux/ http://www.sudo-juice.com/install-mysql-5-5-from-source-ubuntu-linux/

I have fixed this problem by removing LOCAL keyword. 我通过删除LOCAL关键字修复了此问题。 Please remove LOCAL keyword from the command, it will work for mysql server version 5.5.34-0. 请从命令中删除LOCAL关键字,它将适用于mysql服务器版本5.5.34-0。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM