MySQL + SQL · Lesson 104
mysqldump Backup Command
What is mysqldump?
mysqldump is a command-line tool that exports a database (or table) into a single .sql file you can back up or move to another server.
Common Commands
# whole database
mysqldump -u root -p school > school.sql
# one table only
mysqldump -u root -p school students > students.sql
# all databases
mysqldump -u root -p --all-databases > all.sql
Summary
- mysqldump exports databases/tables to .sql files.
- Use it for backups and moving data between servers.