Categories: cPanel

Database connection error: RoundCube in cPanel

Table of Contents

DATABASE ERROR: CONNECTION FAILED! Unable to connect to the database! Please contact your server-administrator.

You’ve to check number of things for troubleshooting this. Please do follow the steps below:

1, Check your MySQL is running or not.

From the command-line you can follow the below pasted command:

/etc/init.d/mysqld status

If it’s running the output should be like;

[root@vps ~]# /etc/init.d/mysqld status mysqld (pid 837) is running…

Okay, then we can move onto database and the user “roundcube”. The database and the user is “roundcube”. The password for the database user will be obtained from the file “/usr/local/cpanel/base/3rdparty/roundcube/config/db.inc.php” in a cPanel server.

# grep roundcube /usr/local/cpanel/base/3rdparty/roundcube/config/db.inc.php $rcmail_config[‘db_dsnw’] = ‘mysql://roundcube:YfxAEk31hEN0dhEF@localhost/roundcube‘; // postgres example: ‘pgsql://roundcube:pass@localhost/roundcubemail’;

2, Check the database connectivity from command line

Yes, we need to verify whether the db user and password is working. Please use the following command:

# mysql -u roundcube -p

If you are able to get in, check the database is listing under the user.

mysql> show databases; +——————–+ | Database | +——————–+ | information_schema | | roundcube | +——————–+ 2 rows in set (0.09 sec)

If the user password is not working that’s reason for this db error. Please reset the user password.

3, Check the tables are existing under the database;

Switch to database “roundcube”;

mysql> use roundcube;

Check tables;

mysql> show tables; +———————+ | Tables_in_roundcube | +———————+ | cache | | cache_index | | cache_messages | | cache_thread | | contactgroupmembers | | contactgroups | | contacts | | cp_schema_version | | dictionary | | identities | | searches | | session | | system | | users | +———————+ 14 rows in set (0.00 sec)

If all tables exists then go ahead and repair the database. Please follow the command to repair a db.

# mysqlcheck -r roundcube

If database or tables are missing, you can rebuild the roundcube from commanline.

Command to rebuild RoundCube:

/usr/local/cpanel/bin/update-roundcube –force

FYI, the force rebuild will results in missing of address book, signatures etc
Otherwise, if you have a backup you can try a restoration instead-of rebuild.

4, RoundCube batabase, user, tables and password all are working. But I have saved address book and others in email accounts, can I rebuild the roundcube safely?

If all working, please take a backup of database then drop it before rebuilding the roundcube.

4.1 Backing up db:

# mysqldump roundcube > roundcube.sql

4.2 Dropping db:

DROP DATABASE roundcube;

Run above command in MySQL prompt.

4.3 Rebuild

/usr/local/cpanel/bin/update-roundcube –force

4.4 Restore

# mysql roundcube < roundcube.sql

That’s it!


Vishwajit Kale
Vishwajit Kale blazed onto the digital marketing scene back in 2015 and is the digital marketing strategist of Hostripples, a company that aims to provide affordable web hosting solutions. Vishwajit is experienced in digital and content marketing along with SEO. He's fond of writing technology blogs, traveling and reading.

Recent Posts

The Ultimate Guide to WordPress Maintenance: Tips and Tricks

When you’re running a business that relies on website traffic and sales to succeed. Then you need to keep it…

2 days ago

Migrate In 2024: Our Comprehensive Website Migration Manual to the Next Level

Migration! Yes, this word is very big in the web hosting industry and it has its importance. Especially for businesses…

4 days ago

Unveiling the Importance of Server Maintenance Plans: A Comprehensive Guide

The server is the backbone of the web hosting industry and it acts like a HERO in the web hosting…

2 weeks ago

IP Address is Blocked? A handpicked list of Solutions to Fix it?

Imagine you are on holiday having a cup of tea and browsing your website or blog.Then, what next?You will get…

3 weeks ago

Explained: Difference between Nameservers Vs. DNS

The web hosting industry is growing every minute, day, and year. It has many terminologies that are important to understand…

1 month ago