PHPMyAdmin说:此MySQL版本不允许使用命令 [英] PHPMyAdmin saying: The used command is not allowed with this MySQL version
问题描述
我是MySQL的Java开发人员.
I am an Java developer new to MySQL.
我想使用PHPMyAdmin执行加载数据操作.加载数据脚本已经过验证,因为它可以在Windows OS配置上很好地工作.尝试从CSV加载数据时,我得到了:
I want to perform Load data operation using 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 :
此MySQL版本不允许使用所使用的命令
The used command is not allowed with this MySQL version
版本详细信息如下
Mysql Server版本: 5.5.34-0
Mysql Server version: 5.5.34-0
操作系统: ubuntu0.13.04.1(Ubuntu)
OS : ubuntu0.13.04.1 (Ubuntu)
我完成了如下编辑my.cnf
的操作:
I am done with editing the my.cnf
as follows:
[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
.........................
我尝试使用-多次重启apache和mysql sudo服务mysql重新启动 sudo服务apache2重新启动
I have tried restarting apache and mysql multiple times using - sudo service mysql restart sudo service apache2 restart
对我没有任何帮助我使用phpmyadmin进行操作的方法.使用以下命令时
Nothing worked for me that help me to perform the operation using phpmyadmin. While using below command
mysql -u root -p --local-infile test
我能够通过mysql提示符成功执行加载数据操作.由于我在块中具有多个CSV,并且每个块都有SQL加载脚本,因此我想使用phpmyadmin一次整体运行(以$分隔的加载脚本).
I am able to perform the Load data operation successfully through mysql prompt. 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.
请帮助我解决此问题. 我已经经历过以下关于堆栈溢出的答案
Please help me to solve this problem. I have already gone through below answers on stack overflow
变量local_infile显示为'ON',我已经使用phpmyadmin上的SQL查询验证了这一点
Variable local_infile is showing as 'ON', I have verified this using SQL query on phpmyadmin
SHOW VARIABLES LIKE "local%"
加载脚本
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.
-
php.ini 的 mysql.allow_local_infile 值错误.必须为- mysql.allow_local_infile = On
php.ini has wrong value for mysql.allow_local_infile. Must be - mysql.allow_local_infile = On
如果您在本地工作,则可以尝试从 SQL查询中删除 LOCAL .也许 MySQL 服务器设置只是不允许您使用 LOCAL 关键字
If you are working locally you can try to remove the LOCAL from your SQL query. Maybe MySQL server settings just don't allow you to use the LOCAL keyword
仅当您使用cPanel 时:问题是cPanel界面内置的phpMyAdmin不使用apache内置的php.因此,您可以整天重建apache,并且不会改变php的编译方式(来自cPanel论坛)
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. So you can rebuild apache all day long and it will not change how php is compiled [from cPanel forum]
希望这会对您有所帮助.
Hope this will help you.
这篇关于PHPMyAdmin说:此MySQL版本不允许使用命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!