Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting to MySQL 4.0 via PHP

Status
Not open for further replies.

peterv6

Programmer
Sep 10, 2005
70
US
I'm attempting to connect to a version 4 MySQL database that my ISP set up for me. I'm using the following script:

<?php
$link = mysql_connect('localhost', 'userid', 'passwd');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>

userid & password are correct in the actual script. I'm getting the following error:

Warning: mysql_connect(): Access denied for user: 'userid@localhost' (Using password: YES) in /usr/local/psa/home/vhosts/vanderhaden.net/httpdocs/mysqlconnect.php on line 2
Could not connect: Access denied for user: 'userid@localhost' (Using password: YES)


Why is it trying to use YES for the password? (That's not the value I'm using.)

The isp is useless as far as helping out on this, can anyone out there help a PHP/MySQL newbie get this fixed?
Thanks in advance....

PETERV
Syracuse, NY &
Boston, MA
 
it is not using the password 'yes'. it is telling you that it is trying to use a password rather than not doing so. the message means that your username and password combo is incorrect.
 
Agreed, I would look in your Mysql Administrator and check that your user has access rights from localhost. Mysql is very particular when it comes to users and where they are connecting from.

So make sure that the location from which you are connecting is a location form which the user is allowed to connect.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top