Applicable to:
- Plesk for Linux
Symptoms
-
RoundCube webmail page is not accessible. The following error message is displayed:
PLESK_INFO: DATABASE ERROR: CONNECTION FAILED
DB Error: SQLSTATE[28000] [1045] Access denied for user 'roundcube'@'localhost' (using password: YES) (GET /roundcube/index.php)
PLESK_INFO: DATABASE ERROR: CONNECTION FAILED! Unable to connect to the database! Please contact your server administrator.
-
The same error may be shown in the log file
/var/log/plesk-roundcube/errors
-
The following MySQL request shows the empty output:
MYSQL_LIN: mysql> select * from mysql.user where user='roundcube';
-
The following error occurs in a log
/var/log/plesk/install/autoinstaller3.log
during a Plesk upgrade:CONFIG_TEXT: Trying to upgrade Roundcube Web Based mail client configs and DB from '1.2.7' to '1.3.6'... Executing database schema update.
ERROR: SQLSTATE[28000] [1045] Access denied for user 'roundcube'@'localhost' (using password: NO)
Error 500: Error connecting to database: SQLSTATE[28000] [1045] Access denied for user 'roundcube'@'localhost' (using password: NO)
Cause
MySQL roundcube
user is either absent or has an invalid password or has not sufficient permissions.
Resolution
Click on a section to expand
-
Log into Plesk.
-
Go to Tools & Settings > Updates.
-
Remove the component
Roundcube
and then install it again.
Note: The solution may be a bit complex. Contact server's administrator or hosting support if required.
-
Connect to the server via SSH.
-
Create Plesk database backup, for example:
# plesk db dump > backup.sql
-
Depending on the RoundCube version, check the database password in
/usr/share/psa-roundcube/config/config.inc.php
or/usr/share/psa-roundcube/config/db.inc.php
:# cat /usr/share/psa-roundcube/config/config.inc.php
$config['db_dsnw'] = 'mysqli://roundcube:password@localhost/roundcubemail'; -
Copy the password;
-
Enter Plesk database:
# plesk db
-
Make sure that 'roundcubemail' database exists:
MYSQL_LIN: mysql> show databases like "%roundcube%";
+------------------------+
| Database (%roundcube%) |
+------------------------+
| roundcubemail |
+------------------------+
1 row in set (0.00 sec)If the database is missing, go back to the first solution via Plesk user interface and reinstall (remove/install) RoundCube component. If the database is present continue this guide.
-
Check whether the
roundcube
user is present. Empty output means that the user is absent:MYSQL_LIN: mysql> use mysql;
mysql> select * from user where user='roundcube'; -
Create user and assign a password:
Note: If the user exists already, it is only needed to generate the password. There is no need for the CREATE USER sentence
For MySQL 5.0/5.1/5.5/5.6 and MariaDB 10.1
MYSQL_LIN: mysql> CREATE USER 'roundcube'@'localhost';
mysql> update user set password=password('<password_from_config.inc.php>') where user ='roundcube';For MySQL 5.7
MYSQL_LIN: mysql> CREATE USER 'roundcube'@'localhost';
mysql> SET PASSWORD FOR 'roundcube'@'localhost' = '<password_from_config.inc.php>';For MariaDB 10.5+
MYSQL_LIN: MariaDB [mysql]> CREATE USER 'roundcube'@'localhost';
MariaDB [mysql]> SET PASSWORD FOR 'roundcube'@'localhost' = PASSWORD('<password_from_config.inc.php>');If the
ERROR 1372 (HY000): Password hash should be a 41-digit hexadecimal number
error occurs while trying to set the password for the roundcube user, it's needed to first encrypt the password obtained on step 3 with:select password('<password_from_config.inc.php>');
, then use this output which is hexa and 41 long to set the password on step 8. -
Grant the necessary privileges:
MYSQL_LIN: 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;Note: if "Can't find any matching row in the user table" error appears when running Grant command, use command without the host:
MYSQL_LIN: mysql> GRANT USAGE ON roundcubemail.* TO 'roundcube';
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON roundcubemail.* TO 'roundcube';
mysql> flush privileges;
Comments
9 comments
So after the update of about a week ago, my Roundcube on a fully upgrade Plesk Onyx on Ubuntu started showing an empty Inbox.
After the latest update I hoped that would be fixed (but it wasn't).
I've removed Roundcube and reinstalled it: still empty Inboxes.
I then removed it again and noticed an error about /usr/lib/psa-roundcube folder not being removed because it wasn't empty.
I then manually deleted the folder and reinstalled, which cause the database connection error mentioned in this article.
I checked that the user was there and did everything is step 6.
On Step 7 I keep getting an error that the roundcube database doesn't exist (and I've re-installed Roundcube multiple times and it always results in a message that the install was successful).
I hope there's a fix for this, because I really dislike Horde.. :(
Server details:
OS: Ubuntu 16.04.4 LTS
Product: Plesk Onyx - Web pro edition
Version 17.8.11 Update #7, last updated on May 8, 2018 07:28 PM
Step 6 refers to setting priveliges on roundcubemail which I have, but 7 refers to testing if roundcube exits, which I dont have. Does roundcube use 2 databases?
Hello @Lars-Erik H.Bergland,
RoundCube uses one database. Step 6 is for creating the database user. Step 7 is for recreating RoundCube database in case it does not exist.
For me after the system update the file
/usr/share/psa-roundcube/config/config.inc.php
was renamed to config.inc.php.dpkg-old and replaced with new file which had empty password. I copied the password from config.inc.php.dpkg-old and pasted it in new file.Also ran /usr/share/psa-roundcube/bin/update.sh to complete the roundcube update.
Hello @Edwin C,
Thank you for sharing your user experience.
I have tried that, but it's not working for me. Apparently I have to tables in my database
show databases like "%roundcube%";
+------------------------+
| Database (%roundcube%) |
+------------------------+
| roundcube |
| roundcubemail |
+------------------------+
2 rows in set (0.000 sec)
I have imported a dump of my previous mySQL db. How can I resolve this?
@Tushar Bhagat,
The issue may be caused by various reasons.
I'd recommend contacting our Support Team directly, so they may investigate your particular case thoroughly.
I changed the user name and password to a known working set in /usr/share/psa-roundcube/config/config.inc.php and voila :)
I could solve my problem for roundcube database connection error via same solution, but only by reading the configured password manually and then set it in mysql:
done. could then enter webmail.DOMAIN.com.
It did not work with the provided solution above, despite I did not get any error!
Please sign in to leave a comment.