5
I still think you have a value in one of the definitions of mainfile.php that does not much the server.
You may test your database with this dbtest.php, that contains:
mysql_connect("MYSQLSERVER", "USERNAME", "PASSWORD") or die(mysql_error());
echo "Connected to MySQL
";
mysql_select_db("DBNAME") or die(mysql_error());
echo "Connected to Database";
?>
You need to replace MYSQLSERVER by the server, probably localhost and DBNAME, USERNAME and PASSWORD by your values (get all 4 from mainfile.php).
What does it say?