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.sqlThis 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.
💻 Live Code Editor
Is page ki language (MYSQL) mein code likhein aur turant chalाएं — yahीं, bina kuch install kiye.Powered by OneCompiler. Agar editor na khule to yahान naye tab mein kholein.
💻 Live Code Editor
Is page ke program yahan ready hain — chalाएं, badlें aur seekhें. Bina kuch install kiye.
Powered by OneCompiler. Editor mein code apne aap aa jata hai — Run dabaakर output dekhें.
Agar load na ho to naye tab mein kholें.