[Freeswitch-users] Switch to MySQL db for config

Eric Schwertfeger ericsgeek at gmail.com
Wed Dec 8 20:27:12 UTC 2021


On 12/7/2021 2:25 PM, TTT wrote:
> I was actually referring to FreeSWITCH core.  I'm reading a book on FreeSwitch  (https://www.amazon.ca/FreeSWITCH-1-8-Anthony-Minessale-II-ebook/dp/B071ZZBH8G/ref=sr_1_3?keywords=freeswitch&qid=1638915802&s=books&sr=1-3) and it mentions that FreeSWITCH keeps its operating information in a database at runtime.  I think it's PostgreSQL
>
> I was wondering if/how I could switch that to MySQL.  I thought there might be a DSN setting in the XML registry that affects this.  This books says you can setup ODBC providers but it's not clear how, or if this applies to "core".

I believe you can.  The module in question is mod_mariadb, but that's 
because it uses the mariadb shared library rather than the mysql shared 
library, not because it only works with mariadb. Those two use 
compatible over-the-wire protocols, so using it to talk to mysql 
shouldn't be an issue.

I haven't tested this with mysql itself, however.  At any rate, these 
are the steps it took for me using MariaDB.  Much simpler than ODBC in 
my opinion.

You will want to make sure that mod_mariadb is installed and preloaded.  
I'm not certain that preloaded is necessary, but it was specified in the 
writeup I found.  So this is the file 
autoload_configs/pre_load_modules.xml from my server.

<configuration name="pre_load_modules.conf" description="Modules">
   <modules>
     <!-- Databases -->
     <load module="mod_mariadb" />
     <!-- <load module="mod_pgsql"/> -->
   </modules>
</configuration>

Then, you need to set the core-db-dsn param in switch.conf.xml as 
mentioned above.  In the case of a mariadb dsn, it would look like this.

<param name="core-db-dsn" 
value="mariadb://Socket=/var/run/mysqld/mysqld.sock;Database=FreeSWITCH;uid=FreeSWITCH;Pwd=XXXXXXXXXXXX"/>

If you're using TCP instead of a unix socket, replace the 
"Socket=[socket name]" with "Host=[host name]" and a setting for Port if 
you're not using the default port.  Also, change the Database and uid 
parameter to suit your setup.

Oh, and as an FYI, the default storage provider that FreeSWITCH uses is 
SQLLite, not PGSQL.





More information about the FreeSWITCH-users mailing list