14.Backup and Disaster Recovery

In this chapter we will look at how to back up or make copies of your databases, how to move them to another machine, and how to recover when things go wrong.

We will cover the following:

• Backing up your databases

• Restoring from backups

• Checking and repairing tables

Backing Up and Restoring Your Database

Obviously, as with any electronic file, you should back up your database files. You may also want to make a copy of your database for replication purposes or to move to a new machine.

There are four ways you can make a backup in MySQL:

• Use the mysqldump script to create a dump file, that is, a file containing the SQL statements necessary to re-create the database.

• Use the mysqlhotcopy ...

Get MySQL Tutorial now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.