Roundcube Database Error cPanel

Discussions related with hosting control panels used, which include cPanel, Plesk, Directadmin etc..
Post Reply
Jackk
Posts: 0
Joined: Fri Apr 13, 2018 7:18 pm

Roundcube Database Error cPanel

Post by Jackk »

Hello,

Receiving error while trying to access the Roundcube in cPanel server.

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

Can anyone please help me out?



_tommy
Posts: 0
Joined: Fri Apr 13, 2018 7:12 pm

Re: Roundcube Database Error cPanel

Post by _tommy »

Hi Jackk,

It seems like you are having issue with mysql. Please check that your MySQL is running or not.

# /etc/init.d/mysql status

OR

# service mysql status

If it is not running restart the service by below command and see if the Roundcube is accessible.

# /etc/init.d/mysql start

OR

# service mysql start



Jackk
Posts: 0
Joined: Fri Apr 13, 2018 7:18 pm

Re: Roundcube Database Error cPanel

Post by Jackk »

Hi Tommy,

I have checked the status of MySQL and found it is working fine. I have also restarted service to see if that fix the issue, but unfortunately, it doesn't.

# service mysql restart

Please help?



shaan
Posts: 0
Joined: Sat Apr 14, 2018 4:21 pm

Re: Roundcube Database Error cPanel

Post by shaan »

Hi Jackk,

In most of the cases, "DATABASE ERROR: CONNECTION FAILED!" error occurs when the MySQL is down or having issues with MySQL.

Since you have checked and restarted MySQL based on Tommy's advice and the issue keeps existing, this can be of something else.

Follow below checks to ensure everything is working fine:

1. Check the database connectivity from the command line

For this, you require Roundcube password. Execute the below command to know the Roundcube password.

Command:
# grep -i "db_dsnw" /usr/local/cpanel/base/3rdparty/roundcube/config/config.inc.php

Output :
$config['db_dsnw'] = 'mysql://roundcube:vbtPXwX#&&@aS7L@unix(/var/lib/mysql/mysql.sock)/roundcube';

From the output, we get know that the password is "vbtPXwX#&&@aS7L"


Now check the database connectivity using below command

# mysql -u roundcube -p

You will be prompted for Roundcube password. Provide the password received earlier(vbtPXwX#&&@aS7L).

If you are able to get in, check whether the database and tables are existing under the database.

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

mysql> use roundcube;
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 you can see the above output, then DB connection is fine.

2. Now try repairing the database.

# mysqlcheck -r roundcube

Once the table is repaired, check Roundcube is working or not.

3. If the issue still exists, rebuild RoundCube and all will be fine.

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


Note : Please do backup RoundCube DB before performing rebuild. So if anything goes wrong after rebuild you can safely restore from backup.

Roundcube DB backup command :
# mysqldump roundcube > roundcube.sql

Roundcube DB restore command :
# mysqldump roundcube < roundcube.sql


Shaan N
Linux Support Engineer.
Nixtree Solutions
Managed Full Server Backups
https://www.nixtree.com/managed-backups.php
Follow us on : https://twitter.com/nixtree



Jackk
Posts: 0
Joined: Fri Apr 13, 2018 7:18 pm

Re: Roundcube Database Error cPanel

Post by Jackk »

Hi Shaan,

You are Awesome!

The issue has been solved by Roundcube rebuild.

Thanks a Billion.



Post Reply