MySQL Connect.php - Can't connect to MySQL server
Posted on 2010-09-24
Every time I try and connect with the below PHP code in my connect.php file, I receive the error:
Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'localhost' (113) in /home/content/k/i/g//html/website/connect.php on line 6
Can't connect to MySQL
(In the above and below example - localhost is our IP address).
$hostname='localhost'; //// specify host, i.e. 'localhost'
$user='######'; //// specify username
$pass='######'; //// specify password
$dbase='ProdDB'; //// specify database name
$connection = mysql_connect("$hostname" , "$user" , "$pass")
or die ("Can't connect to MySQL");
$db = mysql_select_db($dbase , $connection) or die ("Can't select database.");
We have verified that the hardware firewall has allowed port 3306 and port 80. There is no software firewall. We are going from siteA (test website) to SiteB (where the Database is stored with an IP Address).
Thanks in advance!