Unable to connect to database - Earthlink hosting

Permalink
Earthlink requires you to use their File Manager to upload your database, which I have done. Then I uploaded the rest of my site by FTP. When I try to go to my index.php page, I get the "Unable to connect to database" message. My site.php file has been changed to match the necessary server, and all the other info is correct.

Is there anything I might be missing? Has anyone had any experience uploading to Earthlink?

Thanks!

 
RayB replied on at Permalink Reply
Still having this problem. I know that the config script for Concrete and the config script for Earthlink are different, but I went with the Concrete config when trying to connect.

That script is as follows (subbing out my info):
<?php
define('DB_SERVER', 'mysql125.hosting.earthlink.net');
define('DB_USERNAME', 'my_username');
define('DB_PASSWORD', 'my_password');
define('DB_DATABASE', 'my_database');
define('BASE_URL', 'http://www.mysite.com');
define('DIR_REL', '/new_site');
define('PASSWORD_SALT', 'q2zHVfC7Jz0erqCBVzPmklILGFhKilkCYPUMgfsWAfPTY0vqTvVgJZZyV6URPPc5');

The Earthlink suggested script is:
<?php
// Connect to database
$hostname = "mysql125.hosting.earthlink.net";
$username = "my_username";
$password = "my_password";
$dbname = "my_database";
$usertable = "your_tablename";
$yourfield = "your_field";
$yourfield2 = "your_field2";

mysql_connect($hostname, $username, $password) or DIE("Unable to connect to MySQL server $hostname");
print "Connected to MySQL server<br>";
$selected = mysql_select_db($dbname) or DIE("Could not select requested db $dbname");

print "Connected to database $dbname<br>";

$query = "SELECT * FROM $usertable";
$result = mysql_query($query) or DIE("Could not Execute Query on table $usertable");
if ($result) {
print "Query successful on table $usertable<br><br>";
print "Your Query returned:<br>";
while ($row = mysql_fetch_array($result)) {
print "".$row{$yourfield}." ".$row{$yourfield2}." <br>";
}
}
mysql_close;
?>
Should I change my config file to match the Earthlink suggested connection script? If so, I'm not sure what to do when it comes to the usertable and field inquiries.
nteaviation replied on at Permalink Reply
nteaviation
Here is what is in my Bluehost /config/site.php (it may be similar to a earthlink setup). I would go with Concrete5 config like the one below. It may be the DB_SERVER should be "localhost" instead of a FQD address is the issue.
<?php 
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'xxxxxx_cnc1');
define('DB_PASSWORD', 'xxxxxxxxxxxxxxxxxx');
define('DB_DATABASE', 'xxxxxxx_cnc1');
define('BASE_URL', 'http://www.mydomain.com');
define('DIR_REL', '');
define('PASSWORD_SALT', 'xxxxxxxxxxxxxxxxxxxx');
?>
RayB replied on at Permalink Reply
Thanks - but no change. I'm really banging my head on this one. Earthlink is no help at all.
nteaviation replied on at Permalink Reply
nteaviation
Hmm, the error message does not say con't connect to server, it says "Unable to connect to database". Make sure you have the database name correct. Also make sure there is actually a database there with the expected name using a MySQL database tool like phpMyAdmin.