Hi y’ll! Happy Valentine’s Day for those who celebrate it. Me, myself, don’t. Cuz, you know. Enjoying single life. LOL. So yeah right, today I would like to share the easiest way to solve the common RoundCube Database Error: Connection Failed! problem in Vesta Control Panel.
This problem will occurs when you try to access your domain webmail, but then you’ll see a message saying:
DATABASE ERROR: CONNECTION FAILED!
Unable to connect to the database!
Please contact your server-administrator.
It sucks when you’re the server-administrator. You don’t know exactly what to do. Well in my case, after I saw these error warning, I check RoundCube errors log. You can read the errors log by using this commando
cat /var/log/roundcube/errors
What I saw then was:
[11-Feb-2015 14:55:44 +0000]: DB Error: SQLSTATE[28000] [1045] Access denied for user 'roundcube'@'localhost' (using password: YES) (GET /webmail/)
[11-Feb-2015 14:55:47 +0000]: DB Error: SQLSTATE[28000] [1045] Access denied for user 'roundcube'@'localhost' (using password: YES) in /usr/share/roundcube/program/lib/Roundcube/rcube_db.php on line 155 (GET /webmail/)
[11-Feb-2015 14:55:47 +0000]: DB Error: SQLSTATE[28000] [1045] Access denied for user 'roundcube'@'localhost' (using password: YES) (GET /webmail/)
I actually didn’t understand what I saw. I tried to find the error in /usr/share/roundcube/program/lib/Roundcube/rcube_db.php on line 155 but yeah no. It’s not there.
When I asked for a help in VestaCP Forum, I was told to change the password of the user roundcube in /etc/roundcube/debian-db.php and /var/lib/roundcube/config/db.inc.php. The problem is, I don’t even know the password of roundcube. So after thinking out loud for like a day or two, I decided to do these steps that leaded me to solve the problem:
- Log in as root to PHPMyAdmin (http://yourdomain.com/phpmyadmin)
- Go to Database, then create a new database named roundcube, click Create
- Go to User, then Add user, create a new user named roundcube, and enter your desired password, click Go.
- Go to Database again, click on roundcube, go to SQL and paste these codes from http://trac.roundcube.net/browser/github/SQL/mysql.initial.sql?rev=3d4a482fd7527cfd8ee9b86df239b7a833535cd4 and click Go.
- Log out from your PhpMyAdmin and then back to your server.
- Edit your /etc/roundcube/db.inc.php, /etc/roundcube/debian-db.php, and /var/lib/roundcube/config/db.inc.php using
nano
with the password you’ve entered when you created the user roundcube. Also replace localhost with 127.0.0.1 - Go to your VestaCP if you have not created an email account or just go to your Webmail
- The error message is gone and now you can use Roundcube without a problem!
It’s pretty easy right? If you have a problem following these steps don’t be shy to leave a comment. I will guide you til you can solve this problem.