After a fresh install of asterisk on debian lenny system there are certain things to be done.
In order to get asterisk cdr working on a mysql database you need to install the 'asterisk-mysql' package.
To get a feel start RTFM'ing in /usr/share/doc/asterisk-mysql
Edit /etc/asterisk/modules.conf and add this line in the [modules] section:
load => cdr_addon_mysql.so
Next just copy the example cdr_mysql.conf file to /etc/asterisk and edit it.
Don't forget to create your mysql database and cdr table before starting asterisk!
Next install the 'php5-mysql' package and download and install asterisk-stat to get a nice overview of your cdr data.