I am testing the connection in php
mysql_connect("xxx.com", "usernamehere", "passwordhere") or die('cannot connect : '. mysql_error());
But the connection fails and shows [ cannot connect : Access denied for user ''@'localhost' to database 'mysqldb' ]
Since in my php page, I try to login with a username and pw but the error message indicates that is an anonymous login. I am not sure why it happens.
Additional information: I can login successfully when I am using my home Wifi. The problem only occurs with office Wifi.
Thanks a lot.
change this
mysql_connect("mysqldb", "usernamehere", "passwordhere") or die('cannot connect : '. mysql_error());
^ // here it should be hostname not the DB name
to
$conn = mysql_connect("localhost", "usernamehere", "passwordhere") or die('cannot connect : '. mysql_error());
mysql_select_db("mysqldb",$conn);