Hi all,
Using this tip from Mac OS X Hints as a starting point, I've knocked up a quick Bash script to automate the backup of your MT MySQL database:
CODE
#!/bin/bash
db=your_mt_db_name
host=your_hostname
user=your_mysql_username
password=your_mysql_password
backupdir=where_you_want_your_file_to_go
backupfile=`date +\$db\_backup_%d.%m.%y.sql`
cd $backupdir
mysqldump -anlqQ -B $db -h $host -u $user -p$password > $backupfile
db=your_mt_db_name
host=your_hostname
user=your_mysql_username
password=your_mysql_password
backupdir=where_you_want_your_file_to_go
backupfile=`date +\$db\_backup_%d.%m.%y.sql`
cd $backupdir
mysqldump -anlqQ -B $db -h $host -u $user -p$password > $backupfile
Fill in the db,host,user,password and backupdir fields appropriately, save it all as a text file, chmod it to 755, and run it from the command line as needed or set it up as a cron job.
Now, I'm far, far, far from being an expert on MySQL or shell scripts, and for all I know this could eat your computer, mate with your cat, or bleach your hair, so be warned. However, it works for me, producing a file comparable to a default phpMyAdmin dump. Of course, if anyone knows better and can improve on this script (particularly the mysqldump command line options, or with some error checking), that'd be great. It'd also be useful to know if I've just posted something completely stupid and irresponsible, so I can edit this post and feel like an idiot. :-)