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';
6
  • Are you running AppArmor?
    – quanta
    Oct 11 '11 at 15:37
  • Yes. It is installed.
    – OHLÁLÁ
    Oct 11 '11 at 16:24
  • Disable it as a temporary to see if you can connect.
    – quanta
    Oct 11 '11 at 16:28
  • I have uninstalled but still not working,
    – OHLÁLÁ
    Oct 11 '11 at 16:36
  • 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?
    – OHLÁLÁ
    Oct 11 '11 at 16:42
5

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
1
  • PostgreSQL: MDB2_Driver_pgsql
    – d_rail
    Jan 19 '14 at 5:10
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.)

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.

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

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.

0

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

1
  • I already tried that.
    – OHLÁLÁ
    Oct 11 '11 at 16:23
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.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.