Mysql cdr stops working

sometimes the connection between asterisk and mysql stops working.
i dont know why. the message “No such connection ‘Asteriskcdr’ in the ‘adaptive_connection’ section of cdr_adaptive_odbc.conf. Check res_odbc.conf.”

is simply not true. there is “Asteriskcdr” in cdr_adaptive_odbc.conf all the time.

NOTICE[1319] res_odbc.c: Connecting Asteriskcdr WARNING[1319] res_odbc.c: res_odbc: Error SQLConnect=-1 errno=2002 [unixODBC][MySQL][ODBC 5.1 Driver]Can't connect to local MySQL server through socket '/var/run/mysq WARNING[1319] res_odbc.c: Failed to connect to Asteriskcdr WARNING[1319] cdr_adaptive_odbc.c: No such connection 'Asteriskcdr' in the 'adaptive_connection' section of cdr_adaptive_odbc.conf. Check res_odbc.conf.

Because of the error reported three lines earlier.

ok, it looks that after the restart asterisk was started 1s before mysql and that caused this problem.
so, is there a way to tell asterisk to retry the connection ?.