2015-06-04 19:53:48 +02:00
|
|
|
# To dump a database to a file (Note that your password will appear in your command history!):
|
2013-08-27 01:32:38 +02:00
|
|
|
mysqldump -uusername -ppassword the-database > db.sql
|
2013-08-27 01:31:21 +02:00
|
|
|
|
2013-08-22 03:34:11 +02:00
|
|
|
# To dump a database to a file:
|
2013-08-25 09:48:19 +02:00
|
|
|
mysqldump -uusername -p the-database > db.sql
|
2013-08-11 21:37:11 +02:00
|
|
|
|
2015-06-04 19:53:48 +02:00
|
|
|
# To dump a database to a .tgz file (Note that your password will appear in your command history!):
|
2013-08-27 01:32:38 +02:00
|
|
|
mysqldump -uusername -ppassword the-database | gzip -9 > db.sql
|
2013-08-27 01:31:21 +02:00
|
|
|
|
2013-08-22 03:34:11 +02:00
|
|
|
# To dump a database to a .tgz file:
|
2013-08-25 09:48:19 +02:00
|
|
|
mysqldump -uusername -p the-database | gzip -9 > db.sql
|
2013-08-11 21:37:11 +02:00
|
|
|
|
2015-06-04 19:53:48 +02:00
|
|
|
# To dump all databases to a file (Note that your password will appear in your command history!):
|
2013-08-27 01:32:38 +02:00
|
|
|
mysqldump -uusername -ppassword --all-databases > all-databases.sql
|
2013-08-27 01:31:21 +02:00
|
|
|
|
2013-08-22 03:34:11 +02:00
|
|
|
# To dump all databases to a file:
|
2013-08-25 09:48:19 +02:00
|
|
|
mysqldump -uusername -p --all-databases > all-databases.sql
|
|
|
|
|
|
|
|
# To export the database structure only:
|
|
|
|
mysqldump --no-data -uusername -p the-database > dump_file
|
|
|
|
|
|
|
|
# To export the database data only:
|
2013-08-27 01:31:21 +02:00
|
|
|
mysqldump --no-create-info -uusername -p the-database > dump_file
|