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
1 comment
Hi!
After installing Plesk 2 weeks ago and now using Plesk Migrator, I was not able to use Roundcube Webmail.
Futher investigations showed, that the database was not create on installation:
Unfortunately, reinstalling Roundcube using the Plesk updater did not work. It did not create the Plesk DB.
I had a look at the Roundcube documentation and was able to figure out a fix:
plesk db:
then
Please sign in to leave a comment.