Benches macOS

4

Beware: Time Machine doesn't backup MySQL…

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

I have a Mac OS X Server which runs as a webserver. I had to replace the internal harddisk, which is backupped with TM too. So after replacement I restored the system from the TM backup and discovered that I lost some database content. The contents of the restored database content was several days old. This means that TM doesn't backup the database hourly.

FYI I had backupped the database myself to be sure, so I didn't lost any data. But it took some extra work after restoring. All other files on the server were okay.

4 replies

Sign in or join Beachball Help to reply.

  1. 0

    Shane Depner1

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I'm making an assumption here... but your post doesn't have a ton of detail about your setup so...

    It probably has more to do with the fact that you actually shouldn't be backing up a mysql database with time machine if the database is running/live (Of which Time machine has no idea about any of this).

    You can't backup open database just like that and it doesn't only apply to time machine. You need to first be doing a dump of the database either manually or with an automated script and then you could allow time machine to backup the dump. You're asking for trouble and behavior similar to what you noticed here if you backup a mysql (or any other open database) in this manner. This includes the LDAP database if this machine is an OD master and cyrus database if you run the OS X mail server (pre 10.6).

    Just an FYI that it is quite likely that time machine backed up the files in question but that the database was probably damaged or missing data for the reasons I mentioned above.

    There are tools out there that can automate this process (mysql website itself has a Mac GUI client that can do automated backups).

  2. 0

    jaydisc

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I wrote a script that keeps a rolling 7 days of mysql backups which Time Machine can happily backup and you can restore from. It only occurs every 24 hours, so you do risk loosing up to 24 hours of data in a real catastrophe.

    The script and instructions are in
    this thread.

    There's also links there to the official MySQL tools.

  3. 0

    Shane Depner1

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I should have linked that thread since I ended up using your script over the script and / or mysql tools I had been using before :P

    In any case, to OP, the script works well assuming you can suffer the up to 24 hours of data loss as jaydisc mentions. I was more or less just trying to alert you to the fact that you cannot backup
    live database with time machine/backup software. We're not running any e-commerce stuff in our mysql database so a 24 hour loss is acceptable in a complete meltdown. Then again, if you couldn't suffer that then you probably should have a mirror(s) running in addition to backups.

  4. 0

    Chantal C

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Thanks! Will take a closer look!