Jump to content

Archived

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

pkmleo

Database Connection Error

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
[!--quoteo(post=357080:date=Mar 21 2006, 08:36 PM:name=pkmleo)--][div class=\'quotetop\']QUOTE(pkmleo @ Mar 21 2006, 08:36 PM) [snapback]357080[/snapback][/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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

×

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.