How to fix WHMCS database error ‘Could not connect to database server’

How to fix WHMCS database error ‘Could not connect to database server’

In our role as Outsourced server management specialists for web hosts, we manage web servers with various control panels and billing portals such as WHMCS, Blesta, HostBill, etc.

WHMCS is a customer management, billing, and support system for web hosting providers, which is being used by many web hosts nowadays, but it can throw up some errors at times.

See how we help web hosting companies

Recently we were contacted by a customer who was facing WHMCS database errors after reissuing the license and trying to connect to the software.

The error message shown in the portal was ‘Could not connect to database server’.


WHMCS database error



We’ll see here, what causes this WHMCS database error and how we resolved it.

[ You don’t have to lose your sleep over server errors. Our expert server support specialists are online 24/7/365 to help you fix all server errors. ]

How to fix WHMCS database error ‘Could not connect to database server’

WHMCS uses a MySQL database to store all settings and data. The database user should be given adequate privileges to this WHMCS database to perform various operations.

WHMCS database error ‘Could not connect to database server’ normally occurs due wrong username and password combination or because of inadequate privileges.

The database credentials – username, password and name – can be obtained from the config file at ‘configuration.php’. To resolve the error, we obtained the username and password and verified the permissions.

We could see that the user did not have enough privileges to the database. We granted permissions to the user “user_name” to the WHMCS database ‘domain_database’ after connecting to the MySQL interface via backend.

We then tested and confirmed that we are able to login into the MySQL with the same password.

[root@host]# mysql -u user_name -p
Welcome to the MySQL monitor.  Commands end with ; or \g.
mysql> show databases ;
| Database            |
| information_schema  |
| domain_database |
2 rows in set (0.00 sec)

Privileges can also be granted via the cPanel interface of the domain owner. After the privileges were granted and verified, we reloaded the WHMCS portal and it started working fine without issues.

WHMCS can encounter different types of issues, ranging from email issue to PHP compatibility problems or database errors. With our expertise handling web hosts for years, we’ve been able to resolve them in no time.

[ Use your time to build your business. We’ll take care of your servers. Hire Our server experts to solve any server related issue. ]

At Bobcares, our 24/7 server specialists constantly monitor all the services in the server and proactively audit the server for any errors or corruption in them.

With our systematic debugging approach for service or other software errors, we have been able to provide an exciting support experience to the customers.

If you would like to know how to avoid downtime for your customers due to errors or other service failures, we would be happy to talk to you.


Get your servers stable and error-free!

Worried about upgrades and service errors in your web servers? Let us help you.


Submit a Comment

Your email address will not be published. Required fields are marked *

Bobcares is a server management company that helps businesses deliver uninterrupted and secure online services. Our engineers manage close to 51,500 servers that include virtualized servers, cloud infrastructure, physical server clusters, and more.