MySQL + SQL · Lesson 103

MySQL Backup and Restore

Why Backups?

A backup is a saved copy of your database. Restoring it recovers data after accidental deletion, corruption or server failure.

Take a Backup (mysqldump)

mysqldump -u root -p school > school_backup.sql

This creates an .sql file with all CREATE and INSERT statements.

Restore a Backup

mysql -u root -p school < school_backup.sql

Best Practice

Follow the 3-2-1 rule: 3 copies, 2 different media, 1 offsite. Automate daily backups.

Summary

  • mysqldump creates a .sql backup; restore by importing it back.
  • Automate regular backups; keep copies in more than one place.
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

WhatsApp