* V1.4.17 won't access my MySQL-DB

HI,

I try to “upgrade” my running * to RealTime support.

I’ve installed astersk-1.4.17 and asterisk-addons-1.4.5.

Writing cdr’s to my database work’s fine but my asterisk won’t access the database for Asterisk RealTime. Why I think so?
On startup asterisk reports:

== Parsing '/etc/asterisk/res_mysql.conf': Found [Jan 20 21:24:22] WARNING[3013]: res_config_mysql.c:540 parse_config: MySQL RealTime: No database user found, using 'asterisk' as default. [Jan 20 21:24:22] WARNING[3013]: res_config_mysql.c:547 parse_config: MySQL RealTime: No database password found, using 'asterisk' as default. [Jan 20 21:24:22] WARNING[3013]: res_config_mysql.c:554 parse_config: MySQL RealTime: No database host found, using localhost via socket. [Jan 20 21:24:22] WARNING[3013]: res_config_mysql.c:561 parse_config: MySQL RealTime: No database name found, using 'asterisk' as default. [Jan 20 21:24:22] WARNING[3013]: res_config_mysql.c:568 parse_config: MySQL RealTime: No database port found, using 3306 as default. [Jan 20 21:24:22] WARNING[3013]: res_config_mysql.c:575 parse_config: MySQL RealTime: No database socket found, using '/tmp/mysql.sock' as default. [Jan 20 21:24:22] ERROR[3013]: res_config_mysql.c:627 mysql_reconnect: MySQL RealTime: Failed to connect database server asterisk on (err 2002). Check debug for more info. [Jan 20 21:24:22] WARNING[3013]: res_config_mysql.c:474 load_module: MySQL RealTime: Couldn't establish connection. Check debug. [Jan 20 21:24:22] NOTICE[3013]: config.c:1259 ast_config_engine_register: Registered Config Engine mysql MySQL RealTime driver loaded. res_config_mysql.so => (MySQL RealTime Configuration Driver) == Parsing '/etc/asterisk/cdr_manager.conf': Found cdr_manager.so => (Asterisk Manager Interface CDR Backend) == Parsing '/etc/asterisk/extensions.conf': Found
My /etc/asterisk/res_mysql.conf is this one here: [general] dbhost = nss dbname = asterisk dbuser = mark_is_a_geek dbpass = SpEnCeR dbport = 3306 dbsock = /var/lib/mysql/mysql.sock

Accessing my MySQL-database from my linux-konsole works fine:

[code]mysql -h nss -u mark_is_a_geek -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 999 to server version: 5.0.22

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> status;

mysql Ver 14.12 Distrib 5.0.22, for redhat-linux-gnu (i686) using readline 5.0

Connection id: 999
Current database:
Current user: mark_is_a_geek@nss
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.0.22
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: latin1
Conn. characterset: latin1
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 3 days 23 hours 42 min 2 sec

Threads: 1 Questions: 49396 Slow queries: 0 Opens: 0 Flush tables: 1 Open tables: 25 Queries per second avg: 0.143
--------------[/code]

But why reports asterisk that the connection to the database won’t work:

[Nov 19 22:23:07] WARNING[9001] res_config_mysql.c: MySQL RealTime: No database user found, using 'asterisk' as default. [Nov 19 22:23:07] WARNING[9001] res_config_mysql.c: MySQL RealTime: No database password found, using 'asterisk' as default. [Nov 19 22:23:07] WARNING[9001] res_config_mysql.c: MySQL RealTime: No database host found, using localhost via socket. [Nov 19 22:23:07] WARNING[9001] res_config_mysql.c: MySQL RealTime: No database name found, using 'asterisk' as default. [Nov 19 22:23:07] WARNING[9001] res_config_mysql.c: MySQL RealTime: No database port found, using 3306 as default. [Nov 19 22:23:07] WARNING[9001] res_config_mysql.c: MySQL RealTime: No database socket found, using '/tmp/mysql.sock' as default. [Nov 19 22:23:07] ERROR[9001] res_config_mysql.c: MySQL RealTime: Failed to connect database server asterisk on (err 2002). Check debug for more info. [Nov 19 22:23:07] WARNING[9001] res_config_mysql.c: MySQL RealTime: Couldn't establish connection. Check debug. [Nov 19 22:23:07] NOTICE[9001] config.c: Registered Config Engine mysql

I’ve installed asterisk on a second server, but there I’ve have the same problems, so I thing I have eigher a general install-problem or I’m simple to stupid … I hope it’s the first point! :wink: So any help is welcome!

So long,
Michi

HI,

like a good old friend told my, I’ve activeted debug.log og my mysql-deamon.

The only thing I can see, when I start * is:080121 18:07:52 5 Connect astrealtime@localhost on asterisk
Hmmm, that means my * has a problem, isn’t it so?

Any further ideas? :confused:

ciao,
Michi

HI,

so, I’ve some more informations.

When I’ve made some phonecalls may mysql_debug.log shows my some database access’s:080121 19:54:39 27 Connect astrealtime@localhost on asterisk 080121 19:55:07 27 Query INSERT INTO cdr (calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield) VALUES ('2008-01-21 19:54:57','\"Office 2\" <33>','33','63','default', 'SIP/33-096f9098','IAX2/216.207.245.8:4569-1','Dial','IAX2/guest@misery.digium.com/s@default',10,9,'ANSWERED',3,'','1200941697.0','')

On 19:54:39 I’ve started my asterisk an at 19:54:57 I called digium.

So we cann see, database-access to my myasql from asterisk works.

Further I’ve deleated the hole res_mysql.conf and restared asterisk. And what must I see? The same promlem like with my old right res_mysql.conf:[Jan 21 20:27:33] NOTICE[11868]: loader.c:843 load_modules: 1 modules will be loaded. == Parsing '/etc/asterisk/res_mysql.conf': Found [Jan 21 20:27:33] WARNING[11868]: res_config_mysql.c:540 parse_config: MySQL RealTime: No database user found, using 'asterisk' as default. [Jan 21 20:27:33] WARNING[11868]: res_config_mysql.c:547 parse_config: MySQL RealTime: No database password found, using 'asterisk' as default. [Jan 21 20:27:33] WARNING[11868]: res_config_mysql.c:554 parse_config: MySQL RealTime: No database host found, using localhost via socket. [Jan 21 20:27:33] WARNING[11868]: res_config_mysql.c:561 parse_config: MySQL RealTime: No database name found, using 'asterisk' as default. [Jan 21 20:27:33] WARNING[11868]: res_config_mysql.c:568 parse_config: MySQL RealTime: No database port found, using 3306 as default. [Jan 21 20:27:33] WARNING[11868]: res_config_mysql.c:575 parse_config: MySQL RealTime: No database socket found, using '/tmp/mysql.sock' as default. [Jan 21 20:27:33] ERROR[11868]: res_config_mysql.c:627 mysql_reconnect: MySQL RealTime: Failed to connect database server asterisk on (err 2002). Check debug for more info. [Jan 21 20:27:33] WARNING[11868]: res_config_mysql.c:474 load_module: MySQL RealTime: Couldn't establish connection. Check debug. [Jan 21 20:27:33] NOTICE[11868]: config.c:1259 ast_config_engine_register: Registered Config Engine mysql MySQL RealTime driver loaded. res_config_mysql.so => (MySQL RealTime Configuration Driver)

So what now? :angry:

edit:

I’ve turnd on debug in logger.conf, but the only anser I can see is, the old information:[Jan 21 21:19:50] DEBUG[12587] res_config_mysql.c: MySQL RealTime Host: [Jan 21 21:19:50] DEBUG[12587] res_config_mysql.c: MySQL RealTime Port: 3306 [Jan 21 21:19:50] DEBUG[12587] res_config_mysql.c: MySQL RealTime User: asterisk [Jan 21 21:19:50] DEBUG[12587] res_config_mysql.c: MySQL RealTime Password: asterisk [Jan 21 21:19:50] DEBUG[12587] res_config_mysql.c: MySQL RealTime: Cannot Connect (2002): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) [Jan 21 21:19:50] DEBUG[12587] res_config_mysql.c: MySQL RealTime: Cannot Connect: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

ttyl,
Michi

Hello!

[quote=“michinausch”]
My /etc/asterisk/res_mysql.conf is this one here: [general] dbhost = nss dbname = asterisk dbuser = mark_is_a_geek dbpass = SpEnCeR dbport = 3306 dbsock = /var/lib/mysql/mysql.sock[/quote]

:smiling_imp: [size=200]Oh god![/size] :smiling_imp:

I’v found the big mistake! The hole /etc/asterisk/res_mysql.conf was this one:

[code];
; Sample configuration for res_config_mysql.c
;
; The value of dbhost may be either a hostname or an IP address.
; If dbhost is commented out or the string “localhost”, a connection
; to the local host is assumed and dbsock is used instead of TCP/IP
; to connect to the server.
;
;[general]
;dbhost = 127.0.0.1
;dbname = asterisk
;dbuser = myuser
;dbpass = mypass
;dbport = 3306
;dbsock = /tmp/mysql.sock

[general]
dbhost = nss
dbname = asterisk
dbuser = mark_is_a_geek
dbpass = SpEnCeR
dbport = 3306
dbsock = /var/lib/mysql/mysql.sock[/code]

I’ve scored an own big goal! :laughing:

The parser won’t accept an ; (semicolon) for remarks! So he found at the first the old remarks and tried to access my database with the fals datas.

No I’ve deleted the first old lines and may /etc/asterisk/res_mysql.conf has only this few lines:[general] dbhost = nss dbname = asterisk dbuser = mark_is_a_geek dbpass = SpEnCeR dbport = 3306 dbsock = /var/lib/mysql/mysql.sock

And now it works!

[Jan 21 21:36:23] DEBUG[12874] res_config_mysql.c: MySQL RealTime Host: nss [Jan 21 21:36:23] DEBUG[12874] res_config_mysql.c: MySQL RealTime Port: 3306 [Jan 21 21:36:23] DEBUG[12874] res_config_mysql.c: MySQL RealTime User: mark_is_a_geek [Jan 21 21:36:23] DEBUG[12874] res_config_mysql.c: MySQL RealTime Password: SpEnCeR [Jan 21 21:36:23] DEBUG[12874] res_config_mysql.c: MySQL RealTime: Successfully connected to database.

O.K. Thanx for all help! :wink:

cul8r,
Michi