cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unable to connect to mysql server from cpannel using localhost

 

 

 

I have used the following code to connect the mysql server. My site is hosted on cpannel and thus I have used local host. Still I am unable to establish connection. Please help. 

 

<?php
$mysql_hostname = "localhost";
$mysql_user = "*******";
$mysql_password = "**********";
$mysql_database = "************";
$bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Could not connect database");
mysql_select_db($mysql_database, $bd) or mysqli_error();

?>

 

 

1 REPLY 1
Community Manager
Community Manager

Re: Unable to connect to mysql server from cpannel using localhost

Hi @Indranil. Thanks for being part of GoDaddy Community! The most common cause of this issue is that a user has not been created and added to the database. If you do have a user created/added, then you'll want to double check to make sure all your other information is correct. If nothing else, you can reach out to our support team so they can verify that the database can be connected to. 

 

JesseW - GoDaddy | Community Manager | 24/7 support available at x.co/247support | Remember to choose a solution and give kudos.