Database connection error

If you ever get the “Error establishing connection to database.” or “Cannot connect to database.” there could be some possible reasons.

1. Check if MySQL is running

Login to your hosting panel using “admin” user.


Check if the database server (MySQL) is running. If not then start/restart.

server > MySQL > start/restart

IF MySQL does not start/restart

Check if your disk is full.

server > show: CPU/ MEM / NET / DISK

Select “DISK”

2. Check if your database details are correct.

Download your database config file from FTP.

eg. WordPress


You can edit the password from the hosting panel.

user > webuser > login as webuser > db > your_db > edit

Type the password then save.


Knowing the size of your database

It is very important to know the size of your database so you can plan in the future.

To know the size of your database, you can login to your hosting panel using the “admin” user.

user > (webuser) > login as (webuser) > db

When optimizing your database login to “phpMyAdmin” and identifying which table is causing your database to grow big.