Jump to content


Photo

Database Connection Error


  • Please log in to reply
4 replies to this topic

#1 pkmleo

pkmleo
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 21 March 2006 - 01:13 PM

Hi,

I am relatively new to PHP. I installed PHP 4.2.3 with Apache 1.3 and MySQL 5 on Windows XP Pro. When I try to run a simple program that connects to the database and fetch records I get this errors:

Warning: Client does not support authentication protocol requested by server; consider upgrading MySQL client in d:\apache group\apache\htdocs\test\first.php on line 4

Warning: MySQL Connection Failed: Client does not support authentication protocol requested by server; consider upgrading MySQL client in d:\apache group\apache\htdocs\test\first.php on line 4

I dont understand what this means. Should I upgrade PHP. In that case the web hosting company does not support PHP 5. Is there any way to solve this problem. I am using MySQL for Java programs and it works fine.

Cheers,
pkmleo

#2 blazing_bruce

blazing_bruce
  • Members
  • PipPip
  • Member
  • 28 posts
  • LocationIndia

Posted 21 March 2006 - 01:36 PM

will you please show that db connectivity codes? like mysql_connect and are you sure that the port(which is used by mysql )is opened. show your code here plz.

Thank you
Karthi keyan

#3 pkmleo

pkmleo
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 21 March 2006 - 08:36 PM

Thanks for the reply. The code I am using is:

<?php
$db = mysql_connect("localhost","root","root");
mysql_select_db("sitename",$db);
$result = mysql_query("SELECT * FROM creative",$db);
printf("Cat ID: %s<br>\n", mysql_result($result,0,"cat_id"));
printf("Cat Name: %s<br>\n", mysql_result($result,0,"cat_name"));
printf("Job Ref: %s<br>\n", mysql_result($result,0,"job_ref"));
?>

I checked the database its working and I can log into it and I am able to connect to this database using Java. The port is default which is 3306.


#4 keeB

keeB
  • Staff Alumni
  • Advanced Member
  • 1,078 posts
  • LocationCalifornia

Posted 21 March 2006 - 08:42 PM

[!--quoteo(post=357080:date=Mar 21 2006, 08:36 PM:name=pkmleo)--][div class=\'quotetop\']QUOTE(pkmleo @ Mar 21 2006, 08:36 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Thanks for the reply. The code I am using is:

<?php
$db = mysql_connect("localhost","root","root");
mysql_select_db("sitename",$db);
$result = mysql_query("SELECT * FROM creative",$db);
printf("Cat ID: %s<br>\n", mysql_result($result,0,"cat_id"));
printf("Cat Name: %s<br>\n", mysql_result($result,0,"cat_name"));
printf("Job Ref: %s<br>\n", mysql_result($result,0,"job_ref"));
?>

I checked the database its working and I can log into it and I am able to connect to this database using Java. The port is default which is 3306.
[/quote]

Your code is fine, but it seems you have a setting in MySQL, specifically your 'authentication protocol...' I have never sen this error before, so I can't be of much assistance other than to say your code looks fine. I think that you should do some googling, or potentially wait for someone else more knowledgeable to come along.

Good luck

Come visit my site to see my latest projects
http://nick.stinemates.org/wordpress/


#5 craygo

craygo
  • Staff Alumni
  • Advanced Member
  • 1,973 posts
  • LocationRhode Island

Posted 21 March 2006 - 08:45 PM

Go here for solution

[a href=\"http://dev.mysql.com/doc/refman/5.0/en/old-client.html\" target=\"_blank\"]http://dev.mysql.com/doc/refman/5.0/en/old-client.html[/a]

You will have to give yourself a new password but it will fix the problem

Ray




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users