[Kamailio-Devel] Setting mysql socket

Andreas Granig agranig at sipwise.com
Fri Dec 26 09:04:00 CET 2008


Hi,

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:

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?

Andreas



More information about the Devel mailing list