1

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';
Mokus
  • 412
  • 1
  • 11
  • 20

8 Answers8

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
quanta
  • 51,413
  • 19
  • 159
  • 217
4

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.)

andol
  • 6,938
  • 29
  • 43
1

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.

SparX
  • 1,924
  • 12
  • 10
1

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
  • 4,313
  • 2
  • 29
  • 47
zhi
  • 11
  • 1
1

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

0

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
  • 23,274
  • 8
  • 57
  • 89
0

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

jscott
  • 24,484
  • 8
  • 79
  • 100
Matt
  • 83
  • 4
0

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
  • 53,795
  • 33
  • 135
  • 209
Michael M
  • 240
  • 2
  • 6