Help - Search - Members - Calendar
Full Version: Can't Connect to MySQL
HTMLHelp Forums > Programming > Databases
bcmaurer
I have this code in my site, I am running it with apache and my php, mysql, and apache seem to all be working fine, but when I try to call databases, I cannot connect to SQL.

<?php
$conn = mysql_connect('localhost', 'host', '*****');
if (!$conn) {
die('Not connected : ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($conn);

?>


I'm positive that my password is correct, and I believe that my username is host, but I am not sure. When I connect the phpmyadmin my username is host and it works fine.

When I run my site, I get this message:

Not connected : Access denied for user 'host'@'localhost' (using password: YES)


I'm not sure how to troubleshoot this because everything I find says check the variables, and they all seem to be right.

Thank you!!!
bcmaurer
nvm. I figured it out. Thanks anyways.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.