Plesk Roundcube error :Unable to connect to the database

Sometimes you may come across with such an error displayed while going to webmail interface. This can be for both horde or roundcube.

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

To Fix this issue , you need to update the rouncube or horde user password in mysql.user table in the server.

In plesk servers you can do these with the below step

First try to get the version of roundcube

[root@host ~]# rpm -qa | grep -i roundcube
plesk-roundcube-0.9.5-cos6.build115131112.14.noarch
[root@host1~]# rpm -qa | grep -i  roundcube
plesk-roundcube-1.0.0-cos6.build1200140626.18.noarch

For versions below 1 , config file will be /usr/share/psa-roundcube/config/db.inc.php

For version 1 or above, config file will be /usr/share/psa-roundcube/config/config.inc.php

In my case it was /usr/share/psa-roundcube/config/config.inc.php. and content will look like the below

$config[‘db_dsnw’] = ‘mysql://roundcube:pass_from_config@localhost/roundcubemail’;

Note : replace “” pass_from_config “” with correct password from the config.inc.php

Now to fix this issue, Login to mysql as admin user  (as root if cpanel or any other control panel)

root@host1# mysql -uadmin -p`cat /etc/psa/.psa.shadow`
mysql> use mysql;
Database changed
mysql> UPDATE user SET password=PASSWORD('pass_from_config') WHERE user='roundcube';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

After this you should be able to see the webmail login page without any issues

For horde, you can get password for horde user from “/etc/psa-webmail/horde/.horde.shadow” file. To fix the login page issue

root@host1# mysql -uadmin -p`cat /etc/psa/.psa.shadow`
mysql> use mysql;
Database changed
mysql> update user set password=password("pass_from_horde.shadow_file") where user="horde";
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

After these steps the horde webmail interface should work like a charm !!!!

Facebook Comments