[Kamailio-Devel] Setting mysql socket

Henning Westerholt henning.westerholt at 1und1.de
Sun Dec 28 14:11:25 CET 2008

On Fri, December 26, 2008 9:04 am, Andreas Granig wrote:
> I ran into the issue of having two separate local mysql dbs running on
> different unix sockets, and two kamailio instances, each accessing one
> of the dbs. I think there are two ways to approach this, and I'd like to
> hear your opinions before implementing one of these:

Hi Andreas,

> 1. Extending the db_url syntax for mysql to allow a new format
> "mysql://user:pass@/path/to/sock:0/db" or something similar. Question is
> how to separate the db name from the path. Maybe either by requiring a
> port of "0" like shown above, or just taking the last "/" as separator
> for the db name, which could be a bit confusing.
> 2. Adding "mysql_options(handle, MYSQL_READ_DEFAULT_GROUP, kam_group)"
> before mysql_real_connect() to read a my.cnf section, where one could
> specify the socket path. Again, question is how to specifiy the group
> name. Simplest thing would be to add a db_mysql module parameter, but
> one could have the need of connecting to separate dbs with some modules,
> so again a db_url extension could be needed, like
> "mysql://user:pass@[group]/db".
> I personally would rather go with the second approach since it's more
> flexible (one could also pass specific char-sets etc.). Any comments?

I would also prefer the second approach, as i prefer to not change the
db_url syntax that much. There is already a small patch on the tracker
that implements this option [1]. The author also mentioned the use case of
setting certain charsets.

Setting the group with a module parameter in the db_mysql module would
work. But as you said, this would not satisfy your requirements having
several unique groups in different modules. If the addition of the 'group'
db_url parameter could be done in a backward compatible way, then this
would be ok for me.

Happy holidays,



More information about the Devel mailing list