I am unable to connect to database server. What should I do?
I am unable to connect to database server. What should I do?


You must be getting a screen displaying 'Error establishing database connection' as above or a warning as shown below:

Warning: mysql_connect(): Access denied for user: 'user1_name1@localhost' (Using password: YES) in /home/Znet/public_html/db.php on line 216

The above warnings indicate that the website database exists in cPanel, but the website cannot communicate with it. To resolve this issue, we need to perform the steps listed below:

  • Create a new user database and attach that database to the one in which we are facing the issue.
  • We need to create the new user and then attach this user to the erroneous database. Steps for creating the new user are as follows:

1. Log into the cPanel and select MySQL Database.

2. Add users under MYSQL USER tab.

3. Under Add User To Database, choose the user you just created from the User drop-down menu.

4. Choose the name of your database from the Database drop-down menu and click Add.

5. Change the database username in your database configuration file and then check the website.

Ask a question

"Hey couldn't find what you were looking for in our knowledgebase? Please enter your question here".

First Name *
Last Name *
Email Address *
Question *
Captcha *