When I run the following page on my local development environment I'm getting a timeout error on the TCP connection. I've inherited this site recently from another developer. I've pulled all the files on the server and dropped them into my /Users/mycomputer/Sites/testsite.com folder on my MacBook Pro running Lion.
The code I'm running (obviously I've sanitized the code for posting here):
<?php
mysql_connect("mysqldb", "usernamehere", "passwordhere") or die(mysql_error());
echo "Connected to MySQL<br />";
mysql_select_db("test") or die(mysql_error());
echo "Connected to Database";
?>
And the error:
Warning: mysql_connect() [function.mysql-connect]: [2002] Operation timed out (trying to connect via tcp://mysqldb:3306) in /Users/mycomputer/Sites/testsite.com/dbtest.php on line 2
Warning: mysql_connect() [function.mysql-connect]: Operation timed out in /Users/mycomputer/Sites/testsite.com/dbtest.php on line 2
Operation timed out
Any ideas on where I've gone wrong? I'm pretty unskilled in the PHP world so, forgive my ignorance. If this were ColdFusion I would suspect a datasource problem.