Asterisk 1.2.13 connect to mysql error

I have been using asterisk 1.2.13 without any problems for around 5 months now on a centos 4.4 server. I have calls logged to mysql cdr database and some queue stuff loged to postgr sql database.
Mysql is on the same server.

Twice now in the last 24 hours I have received the following errors in the asterisk message log which has stopped the asterisk server. I had to type service asterisk start to get it running again.

Apr 3 07:41:45 ERROR[3630] cdr_addon_mysql.c: Failed to connect to mysql database asterisk on localhost.
Apr 3 07:41:45 ERROR[3630] res_config_mysql.c: MySQL RealTime: Failed to connect database server on (err 2002). Check debug for more info.

Does anyone have any ideas on what to try. I would have thought if it failed to save call details to mysql it would just dump the data and keep asterisk running ??

Thanks

Nick Colyer

turn on debug logging in logger.conf, reload and see what the debug log contains when you lose the connection.

i’ve never seen this before … is the MySQL server heavily used ?

I have a go at the debug log.

Mysql is only used for the cdr logging.
Its been running since 8/Dec/06 to now 3/April/07 and the cdr table has around 102309 records.