if you have problem with hostname, in standard hosting providers this should be localhost, but sometimes not and depends on hosting provider. Please ask your hosting provider which MySQL database hostname and port you should use for database access.
You can also test your database details with this basic connection code to be sure that it’s right:
<?php $servername = "localhost"; $username = "your-username"; $password = "your-password"; $database_name = "your-database-name"; $conn = new mysqli($servername, $username, $password, $database_name); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } echo "Connected successfully"; ?>
Source: http://www.w3schools.com/php/php_mysql_connect.asp
If your database connection works and you still have issue with script connection then please provide me your cpanel login details, database details and website link for test, via email: sanljiljan@geniuscript.com