Kamailio 4.2 -Unable to connect to mysql

General support questions
Post Reply
aokri
Posts: 1
Joined: 2015/04/20 07:50:18

Kamailio 4.2 -Unable to connect to mysql

Post by aokri » 2015/04/20 08:11:13

This topic is for information purposes to assist anyone faced with this problem.

1. Ensure the db_mysql module is installed in kamailio - use find / -iname db_mysql.so
2. Ensure the module is loaded in the kamailio.cfg. Add #!define WITH_MYSQL to the top of the config file if not present
3. Check there is a loadmodule db_mysql in your kamailio.cfg file
4. Ensure the #!define DBURL "mysql:// is configured with the correct login credentials and host IP address for your remote mysql database
5. Also ensure modparam("sqlops","sqlcon" is configured with the correct login crdentials and host ip address for your remote mysql database

MYSQL SERVER END
6. ensure the you have opened a port for access to your mysql server- usually 3306
7. check your mysql server is running and auto starts with bootup service mysqld status and chkconfig mysqld on
8. Edit your my.cnf and add the following:-

[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
skip-name-resolve

The most important part of the my.cnf modification are the two skip lines. Without these lines, the MySQL server lookups hostnames for authentication of each new connection which causes the kamailio mysql client to time out. Hence causing kamailio to fail to start. I hope this helps anyone upgrading to kamailio 4.2.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Kamailio 4.2 -Unable to connect to mysql

Post by TrevorH » 2015/04/20 08:52:12

The OpenSUSE build service has packages for kamailio for the various CentOS releases. You can then install e.g kamailio-mysql and make sure you have the right things loaded. Source builds are discouraged.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply