Forum Moderators: coopster

Message Too Old, No Replies

Access denied using LOAD DATA

with MySQL and PHP

         

planbeta

11:47 am on May 26, 2003 (gmt 0)

10+ Year Member



Hi - trying to get LOAD DATA to work in php (I'm quite new to php/mysql so I've probably done something wrong)

$db = mysql_connect("localhost","dbUsername","dbPassword");
mysql_select_db("dbName",$db);
$result = mysql_db_query($db,"LOAD DATA infile data.txt INTO TABLE dbTable (dbColumn)") or die (mysql_error());

But it comes up with this error:

Access denied for user: 'blahblah@localhost' to database 'Resource id #1'

Is there something wrong with my code?

Cheers

Chris

jatar_k

4:18 pm on May 26, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



The first thing to check would be that you have the proper username/password in your mysql_connect [php.net]. I would think there is something wrong with that since you are denied access.

Also try using "or die" on all 3 mysql calls while you are developing.

planbeta

7:13 pm on May 26, 2003 (gmt 0)

10+ Year Member



Thanks jatar

Someone has told me the problem is to do with privileges in the mysql database (users table) and to File_priv column set to 'Y' or to use GRANT

Could anyone explain how to do this?

Cheers

Chris

jatar_k

9:33 pm on May 26, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



MySQL User Account Management [mysql.com]

syntax is here GRANT and REVOKE Syntax [mysql.com]

it could very well be that the user you are logging in with doesnt have the proper permissions

olwen

3:02 am on May 28, 2003 (gmt 0)

10+ Year Member



This is the answer to a problem I'm having. Hope my hosting company can sort the privileges.