swissmant Posted September 25, 2009 Share Posted September 25, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/175542-access-denied-for-user-odbclocalhost-using-password-no-post-php-upgrade/ Share on other sites More sharing options...
fenway Posted October 5, 2009 Share Posted October 5, 2009 Then PHP doesn't know about the correct access credentials. Quote Link to comment https://forums.phpfreaks.com/topic/175542-access-denied-for-user-odbclocalhost-using-password-no-post-php-upgrade/#findComment-930740 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.