wesupport

Need help?

Our experts have had an average response time of 13.14 minutes in February 2024 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

“Database error connection failed” in RoundCube cPanel – Causes and Fixes

by | Dec 2, 2018

RoundCube Webmail is an easy way to access emails when you are away from home network.

It is a feature rich application and stores all the data in database.

That’s why, in cPanel server, when RoundCube cannot connect to the database, it shows the message “database error connection failed“.

At Bobcares, we help customers to solve such RoundCube database errors as part of our Outsourced Technical Support Services for Web Hosts.

Today, let’s see the top causes for this error and how we fix them.

 

What causes “database error connection failed”?

RoundCube can use different database types like “MySQL” or “SQLite“. It stores all the details of email users, contacts, address books, etc. in this database.

So, the proper working of RoundCube webmail depends on the connection to this database. And, if the application is not able to connect to the database, it results in an error.

The typical RoundCube error message shown in cPanel servers with MySQL database is

DATABASE ERROR: CONNECTION FAILED!

Unable to connect to the database!

Please contact your server-administrator.

This error mainly happens due to :

 

1. Database server not running

When the MySQL server is not running, the RoundCube database will be down. And, the webmail will not be able to connect to the database. Thus, it shows the database connection error.

 

2. Corrupted RoundCube database

Similarly, even if the MySQL server is running, often there can be missing or buggy tables in RoundCube database. Additionally, in cPanel server, the details of all websites are stored in a single RoundCube database. This makes the database very big. These again can cause database connection problems.

 

How to fix RoundCube “database error connection failed” in cPanel ?

For the proper working of RoundCube, the database should be available all the time. Let’s see how our Support Engineers fix the problem.

1. Fix MySQL connection

Here, to ensure that MySQL server is running, we first check with the command:

/etc/init.d/mysql status

And to fix, we just restart the MySQL server to make it running again.

 

2. Restore/Repair database

Here, we first check if the RoundCube database is accessible from the command-line. Then, we check and validate the tables in it.

On seeing problems, we repair the tables first. If a table repair do not fix the connection, our Support Engineers restore the entire database from backup.

The exact command would be:

mysql roundcube < roundcube.sql

Here, roundcube.sql is the backup file of the database.

As a fail safe method, we take proper backup before removing the existing database.

 

3. Covert to SQLite database.

Now that we know this error happens only when RoundCube uses MySQL database, switching to SQLite really helps.

As of cPanel 11.4x, Roundcube only supports SQLite.

Also, there are many benefits for running Roundcube over SQLite including:

  1. Faster than MySQL
  2. Per account RoundCube database
  3. Easy restore and tracking of per user RoundCube database.

Fortunately, cPanel provides ready-made scripts to convert RoundCube to SQLite. So for server-wide conversion, our Support Engineers run the command

/usr/local/cpanel/scripts/convert_roundcube_mysql2sqlite

And to convert specific users, we run:

/scripts/convert_roundcube_mysql2sqlite <user>

Again, we take a complete backup of the RoundCube database prior to the switch.

 

Conclusion

Database error – connection failed” message appears in RoundCube mainly due to database connectivity issues. Today, we’ve seen the top reasons for the error and how our Support Engineers fix them.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

SEE SERVER ADMIN PLANS

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

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

Categories

Tags