mysql connect problem

Do you see any problem with this code?

[php]<?php
$con = mysql_connect(“localhost”,“vamadisz_site”,“pass”);
if (!$con)
{
die('Adatbáziskapcsolódási hiba: ’ . mysql_error());
}
mysql_select_db(“vamadisz_main”, $con);
?>
[/php]

I get the error: Warning: mysql_connect() [function.mysql-connect]: Access denied for user ‘vamadisz_site’@‘localhost’ (using password: YES) in /home/vamadisz/public_html/hu/index.php on line 35

I have a db user vamadisz_site and it is connected to the db vamadisz_main. Thanks for helping. :smiley:

I assume you’ve already double checked MySQL user name, db name and password… Problem may be with the host parameter. In most cases ‘localhost’ should work. But some hosting providers have specific configuration.

For example, if you host your website with Godaddy (shared hosting plan), the MySQL host will look like this:

myname.db.23456789.hostedresource.com

You need to check in your hosting control panel what is correct MySQL host, or ask support.

My guess is the wrong password!

“pass” is not normally allowed as a password, neither is “password” or “god”.

Sponsor our Newsletter | Privacy Policy | Terms of Service