Jump to content

Access denied for user 'ODBC'@'localhost' (using password: NO) post PHP upgrade


swissmant

Recommended Posts

Hi

 

Up until recently I had been successfully running PHP 4.4.4 on my Windows XP system with MySQL 4.1.

 

I had to upgrade PHP to 5.2.10 to become compatible with a client's machine.

 

Now, when I try to access any databases on my local machine I receive the following error:

 

Access denied for user 'ODBC'@'localhost' (using password: NO)

 

I am not sure why I would be receiving this message now as I have only changed the PHP version, no other settings.

 

This is my connection script, but it worked before. What is strange is that it does not throw up an error when connecting to the dB, but rather when I issue the first query...

 

<?php
$dbhostname='localhost:3306';
$username='swissmant';
$password='p7djk3x';
$database='elearning';

$dbc = mysql_connect($dbhostname,$username,$password);
mysql_select_db($database,$dbc) or die('Could not connect to MySQL: '.mysql_error());

$query = "SELECT * FROM `subjects`;"; // <<<<<< This is the line that throws up the 'access denied' error
$result = mysql_query($query);

if(!$result){
echo "Error: Could not select subjects from subjects dB. ".mysql_error();
exit();
} else if(mysql_num_rows($result)==0){
echo "Error: There were no records found in subjects dB.";
exit();
}
?>

 

I have tried setting up a user on my localmachine as per the MySQL article on http://dev.mysql.com/doc/refman/4.1/en/adding-users.html but still the same error.

 

Thanks for any help,

Anthony

Thanks for any help,

Anthony

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.