Bobcares

Plesk Roundcube ‘database error connection failed’

by | May 27, 2021

Wondering how to fix Plesk Roundcube ‘database error connection failed’ error? We can help you!

At times while trying to access the RoundCube webmail page it will turn out to be inaccessible displaying this database error.

Here at Bobcares, we often handle requests from our customers to fix similar Roundcube errors. Today we will see how our support engineers fix this for our customers as a part of our Server Management Services.

What causes Plesk Roundcube ‘database error connection failed’ error

When the RoundCube webmail page is not accessible we may get either of the following error messages:

DATABASE ERROR: CONNECTION FAILED DB Error: SQLSTATE[28000] [1045] Access denied for user ’roundcube’@’localhost’ (using password: YES) (GET /roundcube/index.php)

or

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

Following are the common causes for this error:

  • MySQL Roundcube user is absent
  • The Roundcube user has an invalid password
  • Insufficient permissions.

Methods to fix Plesk Roundcube ‘database error connection failed’ error

Now we can see the ways that our support engineers fix this error.

1. Using Plesk interface

Following are the steps:

1. First, we have to log in to Plesk.

2. Then go to Tools & Settings and take Updates.

3. Now we can remove the component Roundcube and then install it again.


 

2. Using SSH connection

Next, we can see how to fix this error via SSH. However, the solution may be a bit complex.

1. Firstly, we have to connect to the server via SSH.

2. And create Plesk database backup. For this we can use the following command:

# plesk db dump > backup.sql

3. After that, depending on the RoundCube version. Furthermore, we have to check the database password in /usr/share/psa-roundcube/config/config.inc.php or /usr/share/psa-roundcube/config/db.inc.php using the following command:

# cat /usr/share/psa-roundcube/config/config.inc.php
$config['db_dsnw'] = 'mysqli://roundcube:password@localhost/roundcubemail';

4. Now copy the password and enter the Plesk database using the following command:

# plesk db

5. After that we can ensure that ’roundcubemail’ database exists:

ysql> show databa<"%roundcube%";
+------------------------+
| Database (%roundcube%) |
+------------------------+
| roundcubemail          |
+------------------------+
1 row in set (0.00 sec)

If we find the database missing, we must go to the first solution via the Plesk user interface and reinstall (remove/install) the RoundCube component. In case the database is present we can go to the next step.

6. Next, we must check whether the roundcube user is present. (Empty output means that the user is absent.)

We can use the following commands to check this:

mysql> use mysql;
mysql> select * from user where user='roundcube';

7. After that we have to create the user and assign a password (no need to create a user if already exists, simply generate the password).

We can use the following commands for this:

For MySQL 5.0/5.1/5.5/5.6 and MariaDB 10.1

mysql> CREATE USER 'roundcube'@'localhost';
mysql> update user set password=password('<password_from_config.inc.php>') where user ='roundcube';

For MySQL 5.7

mysql> CREATE USER 'roundcube'@'localhost';
mysql> SET PASSWORD FOR 'roundcube'@'localhost' = '<password_from_config.inc.php>';

8. Then we have to grant the necessary privileges using the following command:

mysql> GRANT USAGE ON roundcubemail.* TO 'roundcube'@'localhost';
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON roundcubemail.* TO 'roundcube'@'localhost';
mysql> flush privileges;

If we get the “Can’t find any matching row in the user table” error while running the Grant command,  we can use the following command without the host:

mysql> GRANT USAGE ON roundcubemail.* TO 'roundcube';
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON roundcubemail.* TO 'roundcube';
mysql> flush privileges;

[Need assistance? We can help you]

Conclusion

In short, we saw how our Support Engineers fix Plesk Roundcube’ database error connection failed’ for our customers.

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.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

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

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