English 中文(简体)
LOCAL INFILE 给出错误 此 MySQL 版本不允许使用命令
原标题:LOAD DATA LOCAL INFILE gives the error The used command is not allowed with this MySQL version

我有一个PHP脚本,它调用 MySQL s LOAD Data INFILE 从 CSV 文件装入数据。 然而,在生产服务器上,我最后出错如下:

用户拒绝访问...(使用密码:是)

作为快速的变通,我将命令改为有效操作的 LOAD DATA LOCAL INFILE 。 但是,客户端服务器上的同一命令因此消息而失败 :

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

我想这跟服务器变量有关:local_infiles = off

最佳回答
问题回答

我发现我需要像这样连接到数据库:

$dbh=mysql_connect($server,$dbuser,$dbpass,false,128);

在国旗参数中通过 128 是关键。

http://www.php.net/manual/en/mysql.constats.php#mysql.costants.php#mysql.clients-flags' rel=“不跟随 nofollown noreferrer>>http://www.php.net/manual/en/mysql.constants.php#mysql.clients-flags ,以了解更多关于国旗的信息。

查看此权限列表, 您可以单独添加它们, IE 。 您可以插入但不更新, 或者删除但不选择, 等等...

ALL [PRIVILEGES]    Grant all privileges at specified access level except GRANT OPTION
ALTER   Enable use of ALTER TABLE
ALTER ROUTINE   Enable stored routines to be altered or dropped
CREATE  Enable database and table creation
CREATE ROUTINE  Enable stored routine creation
CREATE TEMPORARY TABLES     Enable use of CREATE TEMPORARY TABLE
CREATE USER     Enable use of CREATE USER, DROP USER, RENAME USER, and REVOKE ALL PRIVILEGES
CREATE VIEW     Enable views to be created or altered
DELETE  Enable use of DELETE
DROP    Enable databases, tables, and views to be dropped
EVENT   Enable use of events for the Event Scheduler
EXECUTE     Enable the user to execute stored routines
FILE    Enable the user to cause the server to read or write files
GRANT OPTION    Enable privileges to be granted to or removed from other accounts
INDEX   Enable indexes to be created or dropped
INSERT  Enable use of INSERT
LOCK TABLES     Enable use of LOCK TABLES on tables for which you have the SELECT privilege
PROCESS     Enable the user to see all processes with SHOW PROCESSLIST
REFERENCES  Not implemented
RELOAD  Enable use of FLUSH operations
REPLICATION CLIENT  Enable the user to ask where master or slave servers are
REPLICATION SLAVE   Enable replication slaves to read binary log events from the master
SELECT  Enable use of SELECT
SHOW DATABASES  Enable SHOW DATABASES to show all databases
SHOW VIEW   Enable use of SHOW CREATE VIEW
SHUTDOWN    Enable use of mysqladmin shutdown
SUPER   Enable use of other administrative operations such as CHANGE MASTER TO, KILL, PURGE BINARY LOGS, SET GLOBAL, and mysqladmin debug command
TRIGGER     Enable trigger operations
UPDATE  Enable use of UPDATE
USAGE   Synonym for “no privileges”

我觉得你有选择,删除,插入,更新, 但不做其他事情,

使用此命令 :

SHOW GRANTS

以我为例,他将展示你的能力。

jcho360> show grants;
+-------------------------------------------------------+
| Grants for jbolivar@localhost                         |
+-------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO  jbolivar @ localhost  |
+-------------------------------------------------------+
1 row in set (0.00 sec)




相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...