MySQL Backup Guide
Backups protect your database from accidental deletion, corruption and server failures.
Backup Single Database
mysqldump -u root -p database_name > backup.sql
Backup All Databases
mysqldump -u root -p --all-databases > all_backup.sql
Restore Database
mysql -u root -p database_name < backup.sql
Cron Job Automation
0 2 * * * mysqldump -u root -pPASSWORD dbname > /backup/db.sql
Best Practices
- Take regular backups
- Store backups on another server
- Test restores regularly
- Use compression for large databases
Top 20 MySQL Interview Questions
Q1. What is mysqldump?
Utility used for logical MySQL backups.
Q2. How do you backup a database?
Using mysqldump command.
Q3. How do you restore a database?
Using mysql command with SQL dump.
Q4. What is logical backup?
Backup stored as SQL statements.
Q5. What is physical backup?
Copy of actual database files.
Q6. How do you backup all databases?
Use --all-databases option.
Q7. What is binary logging?
Records database changes for recovery.
Q8. How do you automate backups?
Using cron jobs.
Q9. What is point-in-time recovery?
Restore database to a specific moment.
Q10. How do you check MySQL version?
SELECT VERSION();
Q11. What is InnoDB?
Default MySQL storage engine.
Q12. What is MyISAM?
Older MySQL storage engine.
Q13. How do you create a database?
CREATE DATABASE dbname;
Q14. How do you create a user?
CREATE USER statement.
Q15. How do you grant privileges?
GRANT command.
Q16. How do you view databases?
SHOW DATABASES;
Q17. How do you view tables?
SHOW TABLES;
Q18. What causes backup failures?
Permissions, storage, locks.
Q19. Backup best practices?
Regular backups and restore testing.
Q20. Explain backup workflow.
Backup → Verify → Store → Restore Test.
MySQL Backup & Restore Guide
Database backup data loss से बचाने के लिए आवश्यक है।
Single Database Backup
mysqldump -u root -p database_name > backup.sql
Restore Database
mysql -u root -p database_name < backup.sql
Top 20 MySQL Interview Questions
प्रश्न 1. mysqldump क्या है?
MySQL logical backup utility।
प्रश्न 2. Database backup कैसे लेते हैं?
mysqldump command से।
प्रश्न 3. Database restore कैसे करते हैं?
mysql command से।
प्रश्न 4. Logical backup क्या है?
SQL statements के रूप में backup।
प्रश्न 5. Physical backup क्या है?
Database files की copy।
प्रश्न 6. सभी databases का backup कैसे लें?
--all-databases option से।
प्रश्न 7. Binary Logging क्या है?
Database changes record करता है।
प्रश्न 8. Backup automate कैसे करें?
Cron jobs से।
प्रश्न 9. Point-in-time recovery क्या है?
Specific time तक restore करना।
प्रश्न 10. MySQL version कैसे देखें?
SELECT VERSION();
प्रश्न 11. InnoDB क्या है?
Default storage engine।
प्रश्न 12. MyISAM क्या है?
पुराना storage engine।
प्रश्न 13. Database कैसे create करें?
CREATE DATABASE command।
प्रश्न 14. User कैसे create करें?
CREATE USER statement।
प्रश्न 15. Privileges कैसे दें?
GRANT command।
प्रश्न 16. Databases कैसे देखें?
SHOW DATABASES;
प्रश्न 17. Tables कैसे देखें?
SHOW TABLES;
प्रश्न 18. Backup failure क्यों होती है?
Permissions या storage issues।
प्रश्न 19. Backup best practices क्या हैं?
Regular backup और testing।
प्रश्न 20. Backup workflow समझाइए।
Backup → Verify → Store → Test Restore.