Author Topic: Can't connect to the database  (Read 4595 times)

Offline richstock

  • Newbie
  • *
  • Posts: 3
Can't connect to the database
« 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';

Offline yllar

  • Full Member
  • ***
  • Posts: 106
Re: Can't connect to the database
« Reply #1 on: December 13, 2006, 08:30:52 AM »
$rcmail_config['db_dsnw'] = 'mysql://roundcube_user:password@localhost/roundcube_database';
irc://irc.freenode.net:6667/#roundcube

Offline richstock

  • Newbie
  • *
  • Posts: 3
Re: Can't connect to the database
« Reply #2 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.

Offline richstock

  • Newbie
  • *
  • Posts: 3
Re: Can't connect to the database
« Reply #3 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:

Code: [Select]
 $rcmail_config['db_dsnw'] = array('phptype'=>'mysql','username'=>'username','password'=>'password','protocol' => 'unix', 'hostspec' => 'host', 'socket' => 'socket location', 'database' => 'database');

Offline Zard

  • Newbie
  • *
  • Posts: 3
Re: Can't connect to the database
« Reply #4 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

Offline Prasad1337

  • Global Moderator
  • Full Member
  • *****
  • Posts: 114
Re: Can't connect to the database
« Reply #5 on: December 14, 2006, 05:52:52 AM »
moved to issues board.

Offline freek

  • Newbie
  • *
  • Posts: 1
this works!
« Reply #6 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