Connecting to MySQL with PHP<

liunx

Guest
I am having a bit of a problem with MySQL and PHP. I use XP and MySQL and Apache are run as services. When I run MySQL Admin the my.ini says that my username is root and my password is darkstreet (which I entered during installation)

So when I type the following into a PHP file:

<?php
mysql_connect("localhost", "root", "darkstreet")
or
die("<i>Could not make the connection!</i>");
?>

And when I run this file, I get the following error:

Warning: Access denied for user: 'root@localhost' (Using password: YES)
in c:\web\user\blog\db_connect.php on line 2

Warning: MySQL Connection Failed:
Access denied for user: 'root@localhost' (Using password: YES)
in c:\web\user\blog\db_connect.php
on line 2
Could not make the connection!

But when I use that same PHP file and remove the password it works fine. (i.e. using mysql_connect("localhost", "root",""))

What am I doing wrong? I really want to have this password protected.try restarting mysqlif that doesn't work then what does your ini file look like?Well I now installed MySQL Control Center and everything is going great - I can no connect with password and everything.

Thanks for your responses.
 
Back
Top