Link to home
Start Free TrialLog in
Avatar of mycroftx
mycroftxFlag for United States of America

asked on

MySQL - mysql_connect won't connect :(

I am using ...
<?php
$link = mysql_connect('localhost', 'mysql_user', 'password');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>
... to connect to a database on a Plesk 9 VPS.  I get this error ...
Could not connect: Access denied for user 'mane_fileuser'@'localhost' (using password: YES)

any help would be awesome as I am stuck :)
Avatar of shobinsun
shobinsun
Flag of India image

Hello,

Error means that you are trying to connect with the user "mane_fileuser" with password option YES is not allowed.

So try with no password.

means:

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


Regards.
Just check the login details. On some hosts you may need to prefix your hosting username. So check with them for the exact details.
Avatar of coolguy2009
coolguy2009

Hi also in some server it is not localhost.

yourusername.localhost

Also check whether the login details are correct.
Avatar of mycroftx

ASKER

I tried it with no password and got the same result, I tried sybtracting the maner_ from the user name with the same result.  Ive got a ticket in with the host but they are saying "Unfortunately, we cannot troubleshoot or write connection strings since it is beyond our support scope."
Ive asked a friend to try the code (function usage is the same) on his web server and it works.  So crap :(
Hello,

If you have mysql prompt then change the mysql password of the recognized user by:

mysql>UPDATE user SET password=password(newpassword) WHERE user=username;

hope this will help you.

Regards.
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
that was awesome, got all the info I needed plus alot to learn from :)
@Ray_Paseur: Great tutorial. Ray Rocks!!!

@mycroftx: In Dreamhost support is good.I am following Ray's way:)
Thanks for the points.  I have heard nothing but good about Dreamhost, and the only reason I do not use them is that they have very rigid limitations on how many emails you can send in a day.  Because I host my church web site and we have to send 2,000+ emails one day every week, they don't work for me.  That is an unfortunate circumstance.  OTOH, I am very happy with ChiHost.com where I am currently hosted.

best to all, ~Ray