If you get a Database error that states “Critical Error – Unable to connect to the Database “, then it would be due to the following:

  1. Incorrect database username and password credentials
  2. Wrong privileges to the database

Verify the username and password that you are trying to connect to the database. Confirm this in the configuration file within your application installation root directory. If that is correct, you can rule out that reason.

Next verify if the MySQL user has the necessary permission to the database. Follow the below steps on cPanel or Command Line.

If you are familiar with command line follow the below steps:

Command Line

1. Login to MySQL Using below command

mysql -u user -p

Where user will be the username

2. Enter the password when prompted

3. Give all privileges to this user on the database

GRANT ALL PRIVILAGES ON db_name.* TO ‘user_name’@’localhost’;

Where db_name will be the database name and the user_name will be the username

If you want to perform the same via cPanel, follow the below steps:

cPanel

  1. Log in to your cPanel account and then on Databases section select MySQL Databases.
  2. Also, scroll down and you will see Add User to Database section. 
  3. Select user and database, on which you want to give privileges to the selected user. Click ‘Add’ button.
  4. You will be redirected to a new page as shown below:
  5. Select all privileges and click ‘Make Changes’ Button.

Critical Error – Unable to connect to the Database

If you have confirmed the above and still the error “Critical Error – Unable to connect to the Database” persists, please contact your server administrator.

If you want all your KPI‘s or Business metrics monitored on a single dashboard, join our BETA.

By Liz Mathew

Founder, InsightDials

error: Content is protected !!