copy the file located in your Installation Path/data/mysql.xml to your User Data Directory.
You must then rename this file to be mysql-port#.xml.
e.g. cp /opt/scorched3d/data/mysql.xml ~/.scorched3d/mysql-27270.xml
The port# is the one used for the players to connect to your server.
eg. The default port is 27270 so this would be mysql-27270.xml
Open the file with a text editor (for example: notepad in Windows, or vi on unix).
Fill in the required information between the empty tags.
e.g. For a mysql database that you connect to as root with no password :
<mysql>
<host>localhost</host>
<user>root</user>
<passwd></passwd>
<db>s3d</db>
<prefix>main</prefix>
<port>/var/lib/mysql/mysql.sock</port>
</mysql>
open the file User Data Directory/server.xml with a a text editor (for example: notepad in Windows or vi on unix).
Search for the tag called: <name>StatsLogger</name> and change the <value>none</value> to <value>mysql</value> or <value>pgsql</value>, according to your database type
Once the stats are being collected there are some administration tasks that may be required. All the commands must be entered through the database client console.