Roundcube is a free and open-source webmail software. Currently, Cpanel uses Roundcube as the default webmail client.
Some of our clients are approached ad regarding the error in Roundcube “Database error connection failed”.
Causes of Roundcube “Database error connection failed”
Roundcube uses MySQL or SQLite as the database type and it stores all the details like email users, contacts, address books, etc.
So it will need the proper connection to the database, if the connection between the database and this application is not working well it will show this database error connection failed.
This error can be caused mainly because of the below reasons :
- Database server is not running :
When the Mysql server is down the Roundcube can’t connect to its database and it produces the database connection failed error.
2. A corrupted Roundcube database :
MySQL /SQLite database with some missing data or tables with bugs can also cause this issue. In the Cpanel server, the details of all Cpanel domain’s emails are stored in a single Roundcube database and this also can make the database very huge. This also can cause a database connection failed error in Roundcube.
- Check MySQL connection :
Check the MySQL database server status using the given command ;
service mysqld status
If it is not running try to restart the MySQL service (You can also check the MySQL logs ).
2. Repair/ Restore the Database :
First, we have to check the Roundcube database is accessible from the command line.
mysql -u roundcube -p mysql> show databases;
Then you can check the tables in the Roundcube database using the below command ;
mysql > show tables;
If all the tables are present there then you can repair the Roundcube database as below. (Take a backup for the database for safety)
mysqlcheck -r roundcube
The Roundcube can be rebuild from the command line using this command. (You can do this if the database or table is missing and it will rebuild the Roundcube database)
If you have the latest database backup available for Roundcube then you can restore the Roundcube database backup.
mysql roundcube < roundcube.sql
You can then remove the existing Roundcube database after the restoration of the database from the latest backup (Take a backup of the existing Roundcube database for a safety measure).
Then you can drop the existing database using ;
mysql > drop database roundcube_old;
3. Convert To SQLite Database type :
If you face this issue only with MySQL database then you can try to switch the Roundcube database to SQLite.
As of Cpanel 11.4.x, Roundcube only supports SQLite.
Pros for using SQLite for Roundcube :
- Faster than MySQL.
- SQLite databases are stored in user accounts and so it considers user’s disk space usage.
- Easy to restore Roundcube data from the backups on a per-user basics.
- Easier to identify problamatic Webmail users.
Cpanel provides scripts to switch Roundcube to use the SQLite database type. You must take a backup of the current database prior to the conversion to SQLite database.
If you need to convert Roundcube for a specific user use this command.
If you are still struggling with the database failed connection error in Roundcube you don’t need to worry about it. Our technical team will take care of your issue and solve it fast.