Hi there,

I used code to fetch email address record from table abc on server but shows

"
Access denied for user 'mysqluser'@'serverip' (using password: YES)
"

/********code ********/
<?php 
include "connection.php";
$tableName  = 'abc';
$todayDate=date("m-d-Y H:i");
$backupFile = '../backup/abc_'.$todayDate.'.csv';
$query      = "SELECT email_address INTO OUTFILE ".$backupFile."  FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '&quot;'
  LINES TERMINATED BY 'auto' FROM ".$tableName;
$result = mysql_query($query);

?>
/********code ********/

Regards,
gptArun

Recommended Answers

All 4 Replies

connection.php is where the error is being generated? I'm guessing you got that connection.php code from somewhere else, but failed to update it with your actual MySQL connection information.

But same connection is working with other files. On same folder "connection.php" resides.

This error usually means the username and password specified are either invalid or have insufficient permissions to the database.

So perhaps try your regular cpanel details in the mysql_connect() function as that gives you full permissions associated to your cpanel account provided your using cpanel. If your not using cpanel then use the details your host has provided when setting up the hosting account although the password may have changed since depending on how much you have changed the settings. If however your using something like wampp or xampp then I would suggest using the root username and password.

thanks for all replies. actually problem is with HOSTNAME. HOSTNAME which i used don't have GRANTS in information_schema database. IP was defined there.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.