Jump to content

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


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...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.