Database error connection failed unable to connect to the database please contact your server administrator

Hello there. So it's my first post here. I decided to make an account here cuz I cant find any solution out there regarding my problem.

godneyjeansus

Posts: 3
Joined: Wed Feb 11, 2015 2:57 pm

[SOLVED] RoundCube: DATABASE ERROR: CONNECTION FAILED!

Hello there. So it’s my first post here. I decided to make an account here cuz I cant find any solution out there regarding my problem.

My server runs Ubuntu 14.04. Btw, I use the free trial Amazon EC2.

I wanted to create an mail account: info@mydomain.com from the VESTA CP

After that I tried to open the webmail but then I saw this error message:

Code: Select all

DATABASE ERROR: CONNECTION FAILED!

Unable to connect to the database!
Please contact your server-administrator.

I then checked the error log:

Code: Select all


[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 don’t know how to solve this problem. Please help me.

Last edited by godneyjeansus on Thu Feb 12, 2015 5:20 pm, edited 1 time in total.


skurudo

VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:

Re: RoundCube: DATABASE ERROR: CONNECTION FAILED!

Post

by skurudo » Thu Feb 12, 2015 10:27 am

I know man ;-)
You need to check password for user roundcube or change it.


skurudo

VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:

Re: RoundCube: DATABASE ERROR: CONNECTION FAILED!

Post

by skurudo » Thu Feb 12, 2015 10:29 am

Here:
/etc/roundcube/debian-db.php
$dbpass= …

And there:
/var/lib/roundcube/config/db.inc.php
$rcmail_config[‘db_dsnw’] = …


godneyjeansus

Posts: 3
Joined: Wed Feb 11, 2015 2:57 pm

Re: RoundCube: DATABASE ERROR: CONNECTION FAILED!

Post

by godneyjeansus » Thu Feb 12, 2015 2:31 pm

skurudo wrote:Here:
/etc/roundcube/debian-db.php
$dbpass= …

And there:
/var/lib/roundcube/config/db.inc.php
$rcmail_config[‘db_dsnw’] = …

HI there, thanks for the reply. Unfortunately I don’t know the password of the user roundcube. Do you know how can I get the password from user roundcube?

By the way, because I don’t know the password of this user roundcube. I decided to make a new user named admin_roundcube and also a new database named admin_roundcube

Then I changed /var/lib/roundcube/config/db.inc.php and /etc/roundcube/debian-db.php with new user and database.
But it doesnt solve my problem. Later I got this message:

Code: Select all


[12-Feb-2015 14:27:56 +0000]: DB Error: [1146] Table 'admin_roundcube.session' doesn't exist (SQL Query: SELECT vars, ip, changed FROM session WHERE sess_id = 'ae8dkd4rs70ld5mm2irebu1v41') in /usr/share/roundcube/program/lib/Roundcube/rcube_db.php on line 417 (GET /webmail/)
[12-Feb-2015 14:27:56 +0000]: DB Error: [1146] Table 'admin_roundcube.session' doesn't exist (GET /webmail/)
[12-Feb-2015 14:27:56 +0000]: DB Error: [1146] Table 'admin_roundcube.session' doesn't exist (SQL Query: INSERT INTO session (sess_id, vars, ip, created, changed) VALUES ('ae8dkd4rs70ld5mm2irebu1v41', 'dGVtcHxiOjE7bGFuZ3VhZ2V8czo1OiJlbl9VUyI7dGFza3xzOjU6ImxvZ2luIjs=', '172.31.44.1', '2015-02-12 14:27:56', '2015-02-12 14:27:56')) in /usr/share/roundcube/program/lib/Roundcube/rcube_db.php on line 417 (GET /webmail/)


godneyjeansus

Posts: 3
Joined: Wed Feb 11, 2015 2:57 pm

Re: RoundCube: DATABASE ERROR: CONNECTION FAILED!

Post

by godneyjeansus » Thu Feb 12, 2015 5:20 pm

Hi, guys. I finally solved it. Here are the steps that I’ve done

1. Log in to PhpMyAdmin
2. Create database named roundcube and user named roundcube MANUALLY
3. Go to localhost —> roundcube (database) —> SQL
4. and pasted this code: http://trac.roundcube.net/browser/githu … a833535cd4 and run it
5. edit /etc/roundcube/db.inc.php, debian-db.php and /var/lib/roundcube/config/db.inc.php with new password (I also replaced localhost with 127.0.0.1
6. Create an email account. Eg. info@maindomain.com
7. Open webmail. Log in. DONE


skurudo

VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:

Re: [SOLVED] RoundCube: DATABASE ERROR: CONNECTION FAILED!

Post

by skurudo » Thu Feb 12, 2015 5:23 pm

So long way. But you made it! Good.

You needed only change password for user roundcube, if you don’t have it and then change configs above.


mehargags

Support team
Posts: 1096
Joined: Sat Sep 06, 2014 9:58 pm
Contact:

Os: Debian 8x
Web: apache + nginx
Re: [SOLVED] RoundCube: DATABASE ERROR: CONNECTION FAILED!

Post

by mehargags » Wed Apr 01, 2015 10:02 am

Well, I noticed the same bug on Debian and Today on Ubuntu 14.04 fresh install.

Infact, Roundcube Databse doesn’t even exist after my VestaCP install.

on CentOS the Vesta installer install everything fine, but not on Ubuntu and Debian


zorrobyte

Posts: 7
Joined: Sun Apr 26, 2015 2:34 pm

Re: [SOLVED] RoundCube: DATABASE ERROR: CONNECTION FAILED!

Post

by zorrobyte » Sun May 24, 2015 1:39 pm

Same, no Roundcube database on fresh install 14.04


skurudo

VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:

Re: [SOLVED] RoundCube: DATABASE ERROR: CONNECTION FAILED!

Post

by skurudo » Sun May 24, 2015 5:41 pm

mehargags wrote:
on CentOS the Vesta installer install everything fine, but not on Ubuntu and Debian

I make many installation on Debian and don’t see a problem, I think it’s repository based problem, guys.


KeiroD

Posts: 61
Joined: Fri Oct 11, 2013 8:35 pm

Re: [SOLVED] RoundCube: DATABASE ERROR: CONNECTION FAILED!

Post

by KeiroD » Mon Jun 08, 2015 7:51 pm

skurudo wrote:

mehargags wrote:
on CentOS the Vesta installer install everything fine, but not on Ubuntu and Debian

I make many installation on Debian and don’t see a problem, I think it’s repository based problem, guys.

The problem exists on Ubuntu as well. Methinks something somewhere is not working properly because I can consistently reproduce this issue.



I just installed the RoundCube php mail client. I check the MySQL database and the new table was created, but through browser I’m getting the following error:

DATABASE ERROR: CONNECTION FAILED!

Unable to connect to the database!
Please contact your server-administrator.

I check the debian-db.php and the login parameters are correct, I also tried through terminal and I can connect to the db using this parameter

$dbuser='roundcube';
$dbpass='mypass';
$basepath='';
$dbname='roundcube';
$dbserver='';
$dbport='';
$dbtype='mysql';

asked Oct 11, 2011 at 15:15

Mokus's user avatar

6

I check the error log and there is the following error:DB Error:
unable to find package ‘MDB2_Driver_mysql’ file
‘MDB2/Driver/mysql.php’, How can I fix this?

apt-get install php-pear
pear install MDB2_Driver_mysql

answered Oct 11, 2011 at 16:45

quanta's user avatar

quantaquanta

50.9k19 gold badges157 silver badges217 bronze badges

1

It seemingly being an Ubuntu system you can also install the driver directly using apt-get.

$ sudo apt-get install php-mdb2-driver-mysql

(The package has been a part of Ubuntu since 10.04.)

answered Oct 11, 2011 at 17:27

andol's user avatar

andolandol

6,85828 silver badges43 bronze badges

1) Enable mysql logging and see whether it is generating any relavent info.

2) Make sure that sql safe mode is not enabled in php

3) Enable sql trace mode in php.ini and see whether it is generating any additional debug info which might be useful.

answered Oct 11, 2011 at 16:46

SparX's user avatar

SparXSparX

1,92412 silver badges10 bronze badges

I’ve just had this error and the change from localhost to 127.0.0.1 fixed it for me!

mysql://roundcube:mypass@127.0.0.1/roundcubemail is now working

answered Jan 24, 2013 at 3:08

Peter Russell's user avatar

Database connection errors happens when the followings happens:

  1. You don’t have proper database info set up in the configuration file (config/db.inc.php)
  2. Your system don’t have the requirements needed to run roundcube.

To solve the first problem, you need to configure the following parameter correctly

$rcmail_config['db_dsnw'] = '{db_provider}://{username}:{password}@{host}/{database}';
  • {db_provider} is database agent such as mysql, mysqli, sqlite etc
  • {username} is your username to the database
  • {password} is your password to the database
  • {host} is either localhost or some host parameter for the location of your database server
  • {database} is your database name, by default it is roundcubemail

Example:

$rcmail_config['db_dsnw'] = 'mysql://myuser:mypassword@localhost/roundcubemail';

To solve the second problem, you need to run the installer to verify your system. Please remove installer/folder once you have done the installation.

To run the test: go to {roundcube_domain}/installer/index.php.

And you will see all the requirements needed to run roundcube. Follow the instruction, you will be running roundcube in no time.

sebix's user avatar

sebix

4,2632 gold badges26 silver badges45 bronze badges

answered Feb 3, 2012 at 15:33

zhi's user avatar

Maybe set $dbserver=''; to $dbserver='localhost'; instead of leaving it blank.

jscott's user avatar

jscott

24.3k8 gold badges78 silver badges99 bronze badges

answered Oct 11, 2011 at 16:12

Matt's user avatar

MattMatt

834 bronze badges

1

I my case, it could not resolve localhost, hence simply changing it to 127.0.0.1 fixed the issue. (I am using Mountain Lion.)

HopelessN00b's user avatar

HopelessN00b

53.6k32 gold badges134 silver badges208 bronze badges

answered Sep 12, 2012 at 22:59

StartupGuy's user avatar

StartupGuyStartupGuy

2302 silver badges6 bronze badges

I had the same issue. This may help someone. Mine was installed using webmin

go to roundcube install location. usually it’s like

/home/domain/public_html/roundcube

open config.inc.php in /home/domain/public_html/roundcube/config

find the line like

$config['db_dsnw'] = 'mysql://mysqluser:password@localhost/database';

either change password here or change the password for user name mysqluser

Gerald Schneider's user avatar

answered May 22, 2022 at 23:03

Nuwinda's user avatar

There are so many reasons for the occurrence of the problem while working with MySQL database connection. Using the details listed below we can rectify the problem. There are few things to be checked while working with the problem. The error that you may get and details to be checked is as follows:

DATABASE ERROR: CONNECTION FAILED!

Unable to connect to the database!

Please contact your server- administrator.

  • YOU HAVE TO CHECK WHETHER MySQL IS WORKING OR NOT

The command line that should be followed is:

If MySQL is working the output should be:

Code:

# /etc/init.d/mysql status
mysqld (pid 837) is running

If it is running then you can move onto database and then to the user “roundcube”. In cPanel you can obtained the password for the database from the file “/usr/local/cpanel/base/3rdparty/roundcube

  • FROM THE COMMAND LINE CHECK FOR THE DATABASE CONNECTIVITY

Using the command line we should find whether the db user and password is working or not.

The database which is listing under the user has to be checked, if it is working.

mysql> show databases;
——————————
Database
information_schema
roundcube
——————————
2 rows in set (0.09 sec)

The reason for the db error is user password. So this can be modified by changing the password.

  • YOU HAVE TO CHECK FOR THE TABLES EXISTING UNDER THE DATABASE

The database is switched to “roundcube” using the following:

The tables is checked as follows

mysql> show tables;
——————————-
Tables_in_roundcube
cache
cache_index
cache_messages
cache_thread
contactgroupmembers
contactgroups
contacts
cp_schema_version
dictionary
identities
searches
session
system
users
—————————-
14 rows in set (0.00 sec)

The database is repaired if the entire table exists. To repair a db follow this command

Code:

# mysqlcheck -r roundcube

The roundcube can be rebuild with the command line if the database or tables is missing. The command used to rebuild roundcube is:

Code:

/usr/local/cpanel/bin/update-roundcube --force

FYI, the force used in the command line is used to rebuild if the results are missing in the address book, signatures, etc. The other option instead of re-build option is restoration if there is a backup.

  • IF ROUNDCUBE DATABASE, USER TABLES AND PASSWORD ARE WORKING AND I HAVE SAVED THE ADDRESS BOOK AND OTHERS IN EMAIL ACCOUNTS, THEN WILL I BE ABLE TO REBUILD THE ROUNDCUBE SAFELY?

The backup of the database has to be taken in account and has to dropped before rebuilding the roundcube if all are working.

— FOR BACKING UP THE DATABASE USE THE FOLLOWING:

Code:

# mysqldump roundcube > roundcube.sql

— FOR DROPPING THE DATABASE:

The command above has to run in MySQL prompt

— FOR REBUILDING PURPOSE:

Code:

/usr/local/cpanel/bin/update-roundcube --force

— TO RESTORE:

Code:

# mysql roundcube < roundcube.sql

Недавно, столкнулся с проблемой в roundcube «DATABASE ERROR: CONNECTION FAILED! «, начал гуглить, но толкового не было ничего. В общем, я нашел материал и сохраню ее для дальнейшего использования. В своей статье «DATABASE ERROR: CONNECTION FAILED! в roundcube» расскажу как исправить данную проблему.

Первый шагом, пробуем просто обновить roundcube из под скриптов Cpanel на самом сервере, а можно это сделать так:

# /usr/local/cpanel/bin/update-roundcube

Это принудительное обновление roundcube со скрипта cpanel.

Если простое обновление не помогло, то идем дальше и следующим действием, я переименую базу самого roundcube (дабы не удалять ее) и после чего выполню повторное обновление:

# mv /var/lib/mysql/roundcube /root/roundcube.bak

Снова выполняем обновление:

# /usr/local/cpanel/bin/update-roundcube --force

При попытки обновить roundcube, получил следующую ошибку:

Archiving current Roundcube data to /var/cpanel/roundcube/roundcube.backup.sql
mysqldump: Got error: 144: Table './roundcube/contacts' is marked as crashed and last (automatic?) repair failed when using 

LOCK TABLES
Failed to backup existing Roundcube DB. DB likely did not exist.Cleaning old Roundcube data archives

Ну что, теперь открываем логи. Roundcube хранит логи в определенном месте на серверах с CPanel, вы можете открыть их:

# tail -f /var/cpanel/roundcube/log/errors

Вы можете повторить этот процесс и посмотреть какая выводится ошибка.  В моем случае я нашел эту ошибку несколько раз:

DB Error: [144] Table './roundcube/contacts' is marked as crashed and last (automatic?) repair failed (SQL Query: SELECT * FROM contacts AS c WHERE c.del<>1 AND

Выход из журнала ошибок и точка прямо установщику, что вызывает проблемы с добавлением контакта в адресной книге. В любом случае, исправление легко и все, что нужно сделать, это восстановить базу данных.

Чтобы запустить восстановление таблицы «Contacts» в базе данных Roundcube, запустите эту команду:

$ cd /var/lib
$ sudo -u mysql myisamchk -r -v -f mysql/roundcube/contacts

Теперь, когда я отремонтировал БД, я попробую запустить обновление еще раз:

# /usr/local/cpanel/bin/update-roundcube --force

Вот и все, у меня все заработало.

Проверяем запущена ли сервер с базами данных:

# ps -aux | grep mysql

Если что, стартуем/перезапускаем его:

# service mysql stop
# service mysql start

или

# service mysql restart

Проверяем есть ли таблицы или сама БД roundcube:

# mysql -uroot -p
> show database;
> use roundcube;
> show tables;

Если пусто, то читаем мою статью:
Восстановить базу данных в Roundcube

А на этому все, тема «DATABASE ERROR: CONNECTION FAILED! в roundcube» завершена.

Hi Jackk,

In most of the cases, «DATABASE ERROR: CONNECTION FAILED!» error occurs when the MySQL is down or having issues with MySQL.

Since you have checked and restarted MySQL based on Tommy’s advice and the issue keeps existing, this can be of something else.

Follow below checks to ensure everything is working fine:

1. Check the database connectivity from the command line

For this, you require Roundcube password. Execute the below command to know the Roundcube password.

Command:
# grep -i «db_dsnw» /usr/local/cpanel/base/3rdparty/roundcube/config/config.inc.php

Output :
$config[‘db_dsnw’] = ‘mysql://roundcube:vbtPXwX#&&@aS7L@unix(/var/lib/mysql/mysql.sock)/roundcube’;

From the output, we get know that the password is «vbtPXwX#&&@aS7L»

Now check the database connectivity using below command

# mysql -u roundcube -p

You will be prompted for Roundcube password. Provide the password received earlier(vbtPXwX#&&@aS7L).

If you are able to get in, check whether the database and tables are existing under the database.

mysql> show databases;
+———————+
| Database |
+———————+
| information_schema |
| roundcube |
+———————+
2 rows in set (0.09 sec)

mysql> use roundcube;
mysql> show tables;

+———————+
| Tables_in_roundcube |
+———————+
| cache |
| cache_index |
| cache_messages |
| cache_thread |
| contactgroupmembers |
| contactgroups |
| contacts |
| cp_schema_version |
| dictionary |
| identities |
| searches |
| session |
| system |
| users |
+———————+
14 rows in set (0.00 sec)

If you can see the above output, then DB connection is fine.

2. Now try repairing the database.

# mysqlcheck -r roundcube

Once the table is repaired, check Roundcube is working or not.

3. If the issue still exists, rebuild RoundCube and all will be fine.

# /usr/local/cpanel/bin/update-roundcube —force

Note : Please do backup RoundCube DB before performing rebuild. So if anything goes wrong after rebuild you can safely restore from backup.

Roundcube DB backup command :
# mysqldump roundcube > roundcube.sql

Roundcube DB restore command :
# mysqldump roundcube < roundcube.sql

Shaan N
Linux Support Engineer.
Nixtree Solutions
Managed Full Server Backups
https://www.nixtree.com/managed-backups.php
Follow us on : https://twitter.com/nixtree

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Database error 2003
  • Database engine tuning advisor does not support sql express dtaclient как исправить
  • Database creation error access denied odoo
  • Database connection error access denied for user
  • Database connection error 2 could not connect to mysql что это значит

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии