Asterisk in Ubuntu 9.04 with MySQL

Hi…
I had installed asterisk and mysql using apt-get in my ubuntu. I had editted the res_mysql.conf, sip.conf, extensions.conf and extconfig.conf.

I get the following error

res_config_mysql.c:629 mysql_reconnect: MySQL RealTime: Failed to connect database server asterisk on (err 2002). Check debug for more info.

Can anyboby help me to solve this error???

Thanks
vdata

You can check debug, check MySQL users, see how you connect to MySQL - through IP or socket…

i cross checked with the my.cnf file and res_mysql.conf files. The configurations are the same, that is, both the sockets and the bind-addresses are the same.

i dont know how to continue???

you have to check MySQL users, tables in MySQL, and of course - if mysql is running.

[quote]es_config_mysql.c:629 mysql_reconnect: MySQL RealTime: Failed to connect database server asterisk on (err 2002). Check debug for more info.
[/quote]

between “on” and “(err 2002)” you should really have the name of whatever you’re trying to connect to.

May I suggest posting the contents of your “res_mysql.conf” & “extconfig.conf”? This will give us a better idea of what it is you have going on here.

The contents of the res_mysql.conf is as follows:

[general]
dbhost=127.0.0.1
dbname=asterisk
dbuser=root
dbpass=root
dbport=3306
dbsock=/var/run/mysqld/mysqld.sock

The contents of extconfig.conf is as follows:

[settings]
sipusers=>mysql,asterisk,sip_buddies
sippeers=>mysql,asterisk,sip_buddies
extensions=>mysql,asterisk,sip_buddies

The contents of extensions.conf is as follows:

[incoming]
switch=>Realtime/@extensions

MySQL database name is asterisk and the table i created for storing sip users and peers is sip_buddies

hey can anybody suggest how to proceed next???

vdata

We upgraded 1.4 to 1.6.1 and one of issues was with MySQL - helped using little bit different name conventions:
extconfig.conf
[settings]
sipusers=>mysql,asterisk,sip_buddies

res_mysql.conf is as follows:

[asterisk]
dbhost=127.0.0.1
dbname=asterisk
dbuser=root
dbpass=root
dbport=3306
dbsock=/var/run/mysqld/mysqld.sock
You can keep general, but as I understand - in extconfig, database meen context in res_mysql.conf

I tried that but i got the same error.

Is there any other compatibility issues with Ubuntu 9.04 and asterisk realtime with MySQL database?

regards

vdata :cry:

The first step I’d take is to log into mysql using the username and password as it appears in your configs. Once in, make sure you can do a select on the realtime tables. If not, the problem may lie with table permissions (i.e. you need to use the GRANT commands in mysql".

Assuming you already did that first step, next I suggest you recompile both asterisk and asterisk-addons. When you compile the addons package, make sure you’re not getting an error about libmysqlclient being missing… If you are, you need to add the path to the mysql lib directory int ld.so.conf, then run “ldconfig”.

In the asterisk-addons directory begin by doing a “make distclean” to clean things out a bit, then do “./configure”, followed by “make menuselect”. Be sure you added the mysql extensions in, then do a “make” and "make install.

I’d suggest completely stopping asterisk, then restarting it from scratch so you know for sure that the recently compiled modules are being used. See if that works.