Roundcube Community Forum

Release Support => Pending Issues => Topic started by: richstock on December 13, 2006, 08:21:08 AM

Title: Can't connect to the database
Post by: richstock on December 13, 2006, 08:21:08 AM
Normally on PHP I have to connect to my mysql database like below:

mysql_connect("localhost:3306:/home/server/mysql/mysql.sock","username","password");

How can I get this working on roundcube?

I tried this in the database settings file:
$rcmail_config['db_dsnw'] = 'mysql://username:password@localhost:3306:/home/server/mysql.sock/roundcube';
Title: Re: Can't connect to the database
Post by: yllar on December 13, 2006, 08:30:52 AM
$rcmail_config['db_dsnw'] = 'mysql://roundcube_user:password@localhost/roundcube_database';
Title: Re: Can't connect to the database
Post by: richstock on December 13, 2006, 08:36:48 AM
but then it's trying to connect through the default socket as defined in the php info which doesn't work on my server?

looking in the error log it give this error:
[13-Dec-2006 13:36:09 +0000] DB Error: DB Error: connect failed in /home/***/www/*******/program/include/rcube_db.inc on line 105

So basically I need to know how to define the Unix socket when using the DB:connect function.
Title: Re: Can't connect to the database
Post by: richstock on December 13, 2006, 10:06:23 AM
Just in case anyone needs this in the future:

I managed to get round it by setting the configuration as:

 $rcmail_config['db_dsnw'] = array('phptype'=>'mysql','username'=>'username','password'=>'password','protocol' => 'unix', 'hostspec' => 'host', 'socket' => 'socket location', 'database' => 'database');
Title: Re: Can't connect to the database
Post by: Zard on December 13, 2006, 04:49:09 PM
hey richstock,

i have exactly the same problem and after hours of searching found your post and solution. unfortunately, i don't understand your php line...

if my mysql 5 connection settings are as follows...
Host: localhost | Socket: /tmp/mysql5.sock

... what would your line of code need to look like?
i'd very much appreciate your help!

thanks,
Zard
Title: Re: Can't connect to the database
Post by: Prasad1337 on December 14, 2006, 05:52:52 AM
moved to issues board.
Title: this works!
Post by: freek on May 16, 2008, 07:21:38 PM
Hey richstock,

thank you very much for this solution!
I have also been looking for hours why RoundCube couldn't connect to my database. Until I discovered that it was looking at the wrong place for the socket file.

Thanks to your post I finally succeeded in getting roundcube running!

Freek