仅用于LOAD操作的PHP Cron作业中的访问被拒绝 [英] Access Denied in PHP Cron job for Only LOAD operation

查看:130
本文介绍了仅用于LOAD操作的PHP Cron作业中的访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这不再是问题....参见下文.

This is no longer a problem.... see below at end.

尝试从CRON作业中的文件加载表时出现以下MySQL错误. 拒绝用户'laurel'@'localhost'的访问(使用密码:是)

I am getting the following MySQL error while trying to LOAD a table from a file in a CRON job. Access denied for user 'laurel'@'localhost' (using password: YES)

这是LOAD语句:

$LoadQuery="load data local infile 'http://example.com/~laurel/csvfiles/handicaps.csv' 
            into TABLE handicap fields terminated by ','";

(路径中实际使用的是IP地址,而不是example.com) 当我在网站,URL行和phpMyAdmin中运行LOAD时,它可以工作.我可以用该用户执行CRON作业中的所有其他操作,包括插入表和删除表.除了LOAD以外的所有内容.当我尝试不使用本地"代码运行它时,会遇到相同的访问错误.并且,在语句中没有"local"的情况下,当从网站和phpMyAdmin运行查询时,我收到访问错误.仅当包含本地"时,它才能在网站和phpMyAdmin上运行.

(the IP address is actually being used in the path instead of example.com) The LOAD works when I run it within the website, from the URL line and from phpMyAdmin. I can do everything else in the CRON job with this user including inserting to a table and deleting a table. Everything except LOAD. When I try running it without the 'local' coded I get the same access error. And, without 'local' in the statement I receive the Access Error when running the query from the website and from phpMyAdmin. It works from the website and from phpMyAdmin only when 'local' is included.

当我从cPanel中查看该用户的权限时,将检查所有特权以及以下各个特权:

When I look at the permissions for this user from the cPanel ALL PRIVILEGES, as well as the following individual priveleges are checked:

 ALL PRIVILEGES
 ALTER   CREATE
 CREATE ROUTINE  CREATE TEMPORARY TABLES
 CREATE VIEW     DELETE
 DROP    EXECUTE
 INDEX   INSERT
 LOCK TABLES     REFERENCES
 SELECT  SHOW VIEW
 TRIGGER     UPDATE

我想念什么?为什么该用户无法执行LOAD功能? 预先感谢您的帮助

What am I missing? Why isn't this user able to do a LOAD function? Thank you in advance for your help

这不再是问题.我对LOAD语句进行了以下更改,它起作用了: $ LoadQuery =将数据本地输入文件\" ../csvfiles/handicaps.csv \加载到以','"结尾的TABLE障碍字段中;

This is no longer a problem. I made the following change to the LOAD statement and it worked: $LoadQuery="load data local infile \"../csvfiles/handicaps.csv\" into TABLE handicap fields terminated by ','";

推荐答案

这不再是问题.

我对LOAD语句进行了以下更改,它起作用了:$ LoadQuery ="load data local infile \" ../csvfiles/handicaps.csv \放入以','"结尾的TABLE障碍字段中;

I made the following change to the LOAD statement and it worked: $LoadQuery="load data local infile \"../csvfiles/handicaps.csv\" into TABLE handicap fields terminated by ','";

这篇关于仅用于LOAD操作的PHP Cron作业中的访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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