UPDATE:
Heh... yeah, you could also just look at that other thread too. I will leave my original post conents below. For reference.
Few ways, few steps:
Method 1, use wget to do it through your webserver:
1) Make a php file with just the sql executions you need to do what you need to do: Connect to mysql, change working database, execute sql, close. Save the file to somewhere your webserver can execute it from a virtualhost.
2) Add this line to your crontab file (normally found at /etc/crontab):
00 00 * root /usr/bin/wget -nv -q http://your.webserver.name/cron.php
Method 2, use commandline PHP to execute it:
1) Make and save the file like above.
2) Add this line to crontab instead:
00 00 * root php -q /path/to/cron.php
Method 2 only works if you have commandline PHP installed exactly like the webserver PHP was installed. Also there are many 'tweaks' and things you can do about logging, output handling, and error control. But thats above what you asked for.