every time I try to connect to database, I get this message database select error .Access denied for user '<username>'@'localhost' to database '<database>'
. My site is hosted remotely . To connect to database , my connect.php
is like :
$host = 'localhost';
$user = '<username>';
$pass = '<password>';
$db = '<database>';
$conn = mysql_connect($host,$user,$pass) or die('Unable to connect to host ');
@mysql_select_db($db,$conn) or die('database select error .'.mysql_error());
I have cross checked the username
and password
,its correct and I have given all the privileges to the user <username>
.
Whats going wrong ?