Hello,
I don’t figure out why Kamailio can’t connect to MySQL DB.
DBURL is set :
# *** Value defines - IDs used later in config
#!ifdef WITH_MYSQL
# - database URL - used to connect to database server by modules such
# as: auth_db, acc, usrloc, a.s.o.
#!define DBURL "mysql://kamailio:PASSWORD@192.168.2.6/kamailio"
#!endif
Each module refer to DBURL, like acc :
# ----- acc params -----
/* what special events should be accounted ? */
modparam("acc", "early_media", 0)
modparam("acc", "report_ack", 1)
modparam("acc", "report_cancels", 1)
/* by default ww do not adjust the direct of the sequential requests.
if you enable this parameter, be sure the enable "append_fromtag"
in "rr" module */
modparam("acc", "detect_direction", 0)
/* account triggers (flags) */
modparam("acc", "log_flag", FLT_ACC)
modparam("acc", "log_missed_flag", FLT_ACCMISSED)
modparam("acc", "log_extra",
"src_user=$fU;src_domain=$fd;src_ip=$si;"
"dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
modparam("acc", "failed_transaction_flag", FLT_ACCFAILED)
/* enhanced DB accounting */
#!ifdef WITH_ACCDB
modparam("acc", "db_flag", FLT_ACC)
modparam("acc", "db_missed_flag", FLT_ACCMISSED)
modparam("acc", "db_url", DBURL)
modparam("acc", "db_extra",
"src_user=$fU;src_domain=$fd;src_ip=$si;"
"dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
#!endif
When I try a connection from MySQL CLI with the same login and password, it works.
Here are the output from /var/log/messages (note that public IP address appears as A.B.C.X) :
Oct 11 16:29:38 localhost /usr/local/sbin/kamailio[10300]: INFO: rr [../outbound/api.h:49]: ob_load_api(): Failed to import bind_ob
Oct 11 16:29:38 localhost /usr/local/sbin/kamailio[10300]: INFO: rr [rr_mod.c:159]: mod_init(): outbound module not available
Oct 11 16:29:38 localhost /usr/local/sbin/kamailio[10300]: INFO: usrloc [hslot.c:53]: ul_init_locks(): locks array size 512
Oct 11 16:29:38 localhost /usr/local/sbin/kamailio[10300]: INFO: auth [auth_mod.c:350]: mod_init(): auth: qop set, but nonce-count (nc_enabled) support disabled
Oct 11 16:29:38 localhost /usr/local/sbin/kamailio[10300]: INFO: <core> [udp_server.c:179]: probe_max_receive_buffer(): INFO: udp_init: SO_RCVBUF is initially 229376
Oct 11 16:29:38 localhost /usr/local/sbin/kamailio[10300]: INFO: <core> [udp_server.c:230]: probe_max_receive_buffer(): INFO: udp_init: SO_RCVBUF is finally 262142
Oct 11 16:29:38 localhost /usr/local/sbin/kamailio[10300]: INFO: <core> [udp_server.c:179]: probe_max_receive_buffer(): INFO: udp_init: SO_RCVBUF is initially 229376
Oct 11 16:29:38 localhost /usr/local/sbin/kamailio[10300]: INFO: <core> [udp_server.c:230]: probe_max_receive_buffer(): INFO: udp_init: SO_RCVBUF is finally 262142
Oct 11 16:29:38 localhost /usr/local/sbin/kamailio[10300]: INFO: rtpproxy [rtpproxy.c:1559]: rtpp_test(): rtp proxy <udp:127.0.0.1:7722> found, support for it enabled
Oct 11 16:29:38 localhost /usr/local/sbin/kamailio[10301]: INFO: rtpproxy [rtpproxy.c:1559]: rtpp_test(): rtp proxy <udp:127.0.0.1:7722> found, support for it enabled
Oct 11 16:29:38 localhost /usr/local/sbin/kamailio[10302]: INFO: rtpproxy [rtpproxy.c:1559]: rtpp_test(): rtp proxy <udp:127.0.0.1:7722> found, support for it enabled
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10303]: ERROR: db_mysql [km_my_con.c:109]: db_mysql_new_connection(): driver error: Can't connect to MySQL server on '192.168.2.6' (4)
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10306]: ERROR: db_mysql [km_my_con.c:109]: db_mysql_new_connection(): driver error: Can't connect to MySQL server on '192.168.2.6' (4)
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10303]: ERROR: <core> [db.c:322]: db_do_init2(): could not add connection to the pool
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10306]: ERROR: <core> [db.c:322]: db_do_init2(): could not add connection to the pool
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10303]: ERROR: acc [acc.c:359]: acc_db_init_child(): unable to connect to the database
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10306]: ERROR: acc [acc.c:359]: acc_db_init_child(): unable to connect to the database
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10303]: ERROR: acc [acc_mod.c:689]: child_init(): could not open database connection
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10306]: ERROR: acc [acc_mod.c:689]: child_init(): could not open database connection
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10303]: ERROR: <core> [sr_module.c:896]: init_mod_child(): init_mod_child(): Error while initializing module acc (/usr/local/lib64/kamailio/modules/acc.so)
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10306]: ERROR: <core> [sr_module.c:896]: init_mod_child(): init_mod_child(): Error while initializing module acc (/usr/local/lib64/kamailio/modules/acc.so)
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10303]: ERROR: <core> [pt.c:350]: fork_process(): ERROR: fork_process(): init_child failed for process 3, pid 10303, "udp receiver child=2 sock=A.B.C.4:5060"
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10306]: ERROR: <core> [pt.c:350]: fork_process(): ERROR: fork_process(): init_child failed for process 6, pid 10306, "udp receiver child=5 sock=A.B.C.4:5060"
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10303]: : <core> [main.c:1630]: main_loop(): main_loop: Cannot fork
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10306]: : <core> [main.c:1630]: main_loop(): main_loop: Cannot fork
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10304]: ERROR: db_mysql [km_my_con.c:109]: db_mysql_new_connection(): driver error: Can't connect to MySQL server on '192.168.2.6' (4)
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10304]: ERROR: <core> [db.c:322]: db_do_init2(): could not add connection to the pool
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10304]: ERROR: acc [acc.c:359]: acc_db_init_child(): unable to connect to the database
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10304]: ERROR: acc [acc_mod.c:689]: child_init(): could not open database connection
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10304]: ERROR: <core> [sr_module.c:896]: init_mod_child(): init_mod_child(): Error while initializing module acc (/usr/local/lib64/kamailio/modules/acc.so)
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10304]: ERROR: <core> [pt.c:350]: fork_process(): ERROR: fork_process(): init_child failed for process 4, pid 10304, "udp receiver child=3 sock=A.B.C.4:5060"
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10304]: : <core> [main.c:1630]: main_loop(): main_loop: Cannot fork
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10305]: ERROR: db_mysql [km_my_con.c:109]: db_mysql_new_connection(): driver error: Can't connect to MySQL server on '192.168.2.6' (4)
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10305]: ERROR: <core> [db.c:322]: db_do_init2(): could not add connection to the pool
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10305]: ERROR: acc [acc.c:359]: acc_db_init_child(): unable to connect to the database
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10305]: ERROR: acc [acc_mod.c:689]: child_init(): could not open database connection
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10305]: ERROR: <core> [sr_module.c:896]: init_mod_child(): init_mod_child(): Error while initializing module acc (/usr/local/lib64/kamailio/modules/acc.so)
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10305]: ERROR: <core> [pt.c:350]: fork_process(): ERROR: fork_process(): init_child failed for process 5, pid 10305, "udp receiver child=4 sock=A.B.C.4:5060"
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10305]: : <core> [main.c:1630]: main_loop(): main_loop: Cannot fork
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10309]: ERROR: db_mysql [km_my_con.c:109]: db_mysql_new_connection(): driver error: Can't connect to MySQL server on '192.168.2.6' (4)
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10309]: ERROR: <core> [db.c:322]: db_do_init2(): could not add connection to the pool
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10309]: ERROR: acc [acc.c:359]: acc_db_init_child(): unable to connect to the database
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10309]: ERROR: acc [acc_mod.c:689]: child_init(): could not open database connection
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10309]: ERROR: <core> [sr_module.c:896]: init_mod_child(): init_mod_child(): Error while initializing module acc (/usr/local/lib64/kamailio/modules/acc.so)
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10309]: ERROR: <core> [pt.c:350]: fork_process(): ERROR: fork_process(): init_child failed for process 9, pid 10309, "udp receiver child=8 sock=A.B.C.4:5060"
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10309]: : <core> [main.c:1630]: main_loop(): main_loop: Cannot fork
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10300]: ERROR: db_mysql [km_my_con.c:109]: db_mysql_new_connection(): driver error: Can't connect to MySQL server on '192.168.2.6' (4)
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10308]: ERROR: db_mysql [km_my_con.c:109]: db_mysql_new_connection(): driver error: Can't connect to MySQL server on '192.168.2.6' (4)
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10300]: ERROR: <core> [db.c:322]: db_do_init2(): could not add connection to the pool
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10300]: ERROR: usrloc [ul_mod.c:437]: child_init(): child(0): failed to connect to database
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10308]: ERROR: <core> [db.c:322]: db_do_init2(): could not add connection to the pool
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10300]: ERROR: <core> [sr_module.c:896]: init_mod_child(): init_mod_child(): Error while initializing module usrloc (/usr/local/lib64/kamailio/modules/usrloc.so)
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10308]: ERROR: acc [acc.c:359]: acc_db_init_child(): unable to connect to the database
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10308]: ERROR: acc [acc_mod.c:689]: child_init(): could not open database connection
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10300]: ERROR: <core> [main.c:1716]: main_loop(): ERROR: main: error in init_child
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10307]: ERROR: db_mysql [km_my_con.c:109]: db_mysql_new_connection(): driver error: Can't connect to MySQL server on '192.168.2.6' (4)
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10307]: ERROR: <core> [db.c:322]: db_do_init2(): could not add connection to the pool
Oct 11 16:29:40 localhost /usr/local/sbin/kamailio[10330]: INFO: <core> [main.c:854]: sig_usr(): INFO: signal 15 received
[...]
Many thanks for your help.
Regards,
Igor.