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)or
PLESK_INFO: DATABASE ERROR: CONNECTION FAILED! Unable to connect to the database! Please contact your server-administrator.
Cause
MySQL roundcube
user is either absent or have an invalid password or have not sufficient permissions.
Resolution
Click on a section to expand
Using Plesk interface
-
Log into Plesk.
-
Go to Tools & Settings > Updates.
-
Remove the component
Roundcube
and then install it again.
Using SSH connection
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:[email protected]/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>‘; -
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;