티스토리 뷰

728x90
반응형

Cheat Sheet

---
tags: [ database ]
---
# To dump a database to a file (Note that your password will appear in your command history!):
mysqldump -u<username> -p<password> <database> > db.sql

# To dump a database to a file:
mysqldump -u<username> -p <database> > db.sql

# To dump a database to a .tgz file (Note that your password will appear in your command history!):
mysqldump -u<username> -p<password> <database> | gzip -9 > db.sql

# To dump a database to a .tgz file:
mysqldump -u<username> -p <database> | gzip -9 > db.sql

# To dump all databases to a file (Note that your password will appear in your command history!):
mysqldump -u<username> -p<password> --all-databases > all-databases.sql

# To dump all databases to a file:
mysqldump -u<username> -p --all-databases > all-databases.sql

# To export the database structure only:
mysqldump --no-data -u<username> -p <database> > dump_file

# To export the database data only:
mysqldump --no-create-info -u<username> -p <database> > dump_file

 

더 보기

https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html

 

MySQL :: MySQL 8.0 Reference Manual :: 4.5.4 mysqldump — A Database Backup Program

4.5.4 mysqldump — A Database Backup Program The mysqldump client utility performs logical backups, producing a set of SQL statements that can be executed to reproduce the original database object definitions and table data. It dumps one or more MySQL da

dev.mysql.com

 

728x90
반응형
댓글