We are migrating from cdr mysql to cdr odbc. I’ve installed unixODBC and conector MySQL (my database is mysql) I’m running a test using Asterisk 13.19.0 on CentOS 7.9 I’ve using this guide: https://wiki.asterisk.org/wiki/display/AST/Configuring+res_odbc but when I try to put a call, I’m getting this message: res_odbc.c:958 odbc_obj_connect: res_odbc: Error SQLConnect=-1 errno=2002 [unixODBC][MySQL][ODBC 5.3(w) Driver]Can’t connect to local MySQL server through socket '/tmp/mysql [Jan 5 16:05:00] ERROR[68847]: cdr_odbc.c:175 odbc_log: Unable to retrieve database handle. CDR failed. I configured /etc/odbcinst.ini, /etc/odbc.ini, /etc/asterisk/res_odbc.conf, /etc/asterisk/res_odbc.conf but when I execute odbc show, I got this: ODBC DSN Settings -----------------
** Name: asterisk**
** DSN: asterisk**
** Last connection attempt: 2021-01-05 16:06:11**
** Number of active connections: 0 (out of 1)**
isql -v asterisk
[08S01][unixODBC][MySQL][ODBC 5.3(w) Driver]Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)
[ISQL]ERROR: Could not SQLConnect
That would be done with the socket variable in my.cnf.
I think you need to take a step back and figure out what you’re trying to accomplish. Do you want to configure ODBC to connect via socket or do you want it to connect via IP?.. or are you just desperately trying to get it to work any method possible? However if it was used via IP when cdr mysql worked, I would continue to connect via IP instead of mucking around with your mysql instance.
Please note ‘~/.my.cnf’ (‘tilde slash dot’) is for the shell. ‘/etc/my.cnf’ (and /etc/my.cnf.d/ if used) is for the daemon. In any case, both are unrelated to ODBC – except to give you a clue to the location of the MySQL daemon socket.