29

Database Maintenance

In this chapter, you’ll learn how to perform common database maintenance tasks.

Backing Up Data

Like all other data, MySQL data must be backed up regularly. Because MySQL databases are disk-based files, normal backup systems and routines can back up MySQL data. However, those files are always open and in use, so normal file copy backups might not always work.

Here are possible solutions to this problem:

  • Use the command-line utility mysqldump to dump all database contents to an external file. This utility should ideally be run before regular backups occur so the dumped file will be backed up properly.

  • Use the command-line utility mysqlhotcopy to copy all data from a database. (This utility is not supported by all database ...

Get MySQL Crash Course, 2nd Edition 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.