...

View Full Version : connect to mysql



Aymen++
04-14-2004, 09:25 AM
i have this code:


<?php
$conn = mysql_connect("localhost", "root", "elephant");
echo "$conn";
?>

and this is the output:
Warning: MySQL Connection Failed: Client does not support authentication protocol requested by server; consider upgrading MySQL client in c:\program files\apache group\apache\htdocs\test\index.php on line 9

and this code:


<?php
$conn = mysql_connect();
echo "$conn";
?>

i have this output:
Resource id #1

what does it mean?

Nightfire
04-14-2004, 11:41 AM
You can't echo out a connection. Usually your mysql connection doesn't have a password either if it's on your pc.


<?php
$link = mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("databasename",$link) or die(mysql_error());
?>

That's what you should have to start off with

Aymen++
04-14-2004, 11:46 AM
when i do it in dos prompt everything is ok, i have a user named: root with password: elephant.
what is the problem pliz. :(

Nightfire
04-14-2004, 11:52 AM
Another thing, what mysql version are you using? You should be using mysql 3.*

Aymen++
04-14-2004, 11:54 AM
it is ver 5.0.0-alpha

Nightfire
04-14-2004, 11:57 AM
I don't think php supports that version yet. Think it only supports version 3.*

Aymen++
04-14-2004, 11:58 AM
thanxxxxxxxxx :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum