Hi,Kinda.
Something bad happened the other day, a query hosed all the data in my table, but luckily I had an original dump of the table from 4 months ago and binlogs from then on. I had to load the original table into a separate db and then grep through the binlogs for queries to update it with, stopping at the one that hosed my data. Anyway, it was a project and it seems like there should be a better way. Is there?
Firstly, I use the human-readable log, which is produced with the --log-update option of mysqld.
Secondly, back up your data more often. Every night is good...
Most likely using the --log-update option slows things down a little during inserts / updates, but it's so much easier to read than the binary log.
I activate this backup script via crond every night:
#/bin/sh
DATE=`/bin/date +%d"-"%m"-"%y`
cd /root/sql/backups for I in EnergyShop NUS ebills irm mysql sales Fuel do /usr/local/mysql/bin/mysqldump -v --opt $I > $I.dump -pMyPasswordGoesHere done
/usr/local/mysql/bin/mysqladmin shutdown -pMyPasswordGoesHere
/usr/bin/nice -n -10 /usr/local/mysql/bin/mysqld_safe --enable-locking --log-update --log-slow-queries --log-long-format &
cd ..
tar -zcvf backups_$DATE.tar.gz backups
echo "Backup of MySQL databases complete!"
-- Daniel Kasak IT Developer * NUS Consulting Group* Level 18, 168 Walker Street North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: www.nusconsulting.com
--------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php