Created
May 22, 2017 15:51
-
-
Save MrChebik/66784172222198fb258ba44288ee253d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RECOMMEND TO SAVE ALSO ALL NATIVE FILES FROM DATABASE | |
-- backup | |
mysqldump -u USER -pPASSWORD DATABASE > /path/to/file/dump.sql | |
-- structure database | |
mysqldump --no-data - u USER -pPASSWORD DATABASE > /path/to/file/schema.sql | |
-- dump of one or else tables | |
mysqldump -u USER -pPASSWORD DATABASE TABLE1 TABLE2 TABLE3 > /path/to/file/dump_table.sql | |
-- backup and archive | |
mysqldump -u USER -pPASSWORD DATABASE | gzip > /path/to/outputfile.sql.gz | |
-- backup with date | |
mysqldump -u USER -pPASSWORD DATABASE | gzip > `date +/path/to/outputfile.sql.%Y%m%d.%H%M%S.gz` | |
-- put backup to database | |
mysql -u USER -pPASSWORD DATABASE < /path/to/dump.sql | |
-- from archive | |
gunzip < /path/to/outputfile.sql.gz | mysql -u USER -pPASSWORD DATABASE | |
//or// | |
zcat /path/to/outputfile.sql.gz | mysql -u USER -pPASSWORD DATABASE | |
-- advanced options | |
mysqldump -Q -c -e -u USER -pPASSWORD DATABASE > /path/to/file/dump.sql, где: | |
-Q wraps names in backticks | |
-c makes the complete box, including the names of the columns | |
-e doing an extended insert. The resulting file is smaller and it is a little faster | |
For InnoDB you need to add --single-transaction | |
For MyISAN it is not actually |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment