Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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';
share|improve this question
    
Are you running AppArmor? –  quanta Oct 11 '11 at 15:37
    
Yes. It is installed. –  run 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, –  run 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? –  run Oct 11 '11 at 16:42

7 Answers 7

up vote 5 down vote accepted

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
share|improve this answer
    
PostgreSQL: MDB2_Driver_pgsql –  d_rail Jan 19 at 5:10

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

share|improve this answer

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.

share|improve this answer

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

ex $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. Hope this helpful.

share|improve this answer

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

share|improve this answer

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

share|improve this answer
    
I already tried that. –  run Oct 11 '11 at 16:23

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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