MySQL·MySQL from first query to production

Backups and restore

Make logical backups, verify them and practise restoring.

Beginner 13 min read Lesson 9 of 300 Challenge included
What you will be able to do
  • Schedule backups and keep several generations.
  • Encrypt backups at rest.
  • Restore into a separate database to verify.
  • Record the restore runbook.

In plain English

A backup you have never restored is a hope. Use mysqldump for logical backups or physical snapshots for large databases. Test the restore into a scratch database and compare row counts.

backup.shTerminal
mysqldump --single-transaction --routines --triggers edubyte > edubyte.sql
mysql -e 'CREATE DATABASE edubyte_restore'
mysql edubyte_restore < edubyte.sql
mysql -e 'SELECT COUNT(*) FROM edubyte_restore.lessons'
Your turn

Write a dump command

Easy

Write a mysqldump command for the edubyte database using --single-transaction.

BASH · starter
mysqldump
Check your understanding before moving on.
Knowledge checkQuestion 1

Which flag gives a consistent InnoDB backup without blocking writes?

Select an answer to continue
Study tools

Make it yours.

Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.

Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign in
Finished reading?

Lock in what you just learned.

Mark this lesson complete to save your place and move one step closer to the certificate.

Next: Performance tuning
Lesson 9 of 300 · 0% of course