Created
February 27, 2016 14:39
-
-
Save dfunaki/07d40f5f324f85bd4d78 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
Dump and restore a single table from .sql | |
Dump | |
mysqldump db_name table_name > table_name.sql | |
Dumping from a remote database | |
mysqldump -u <db_username> -h <db_host> -p db_name table_name > table_name.sql | |
For further reference: | |
http://www.abbeyworkshop.com/howto/lamp/MySQL_Export_Backup/index.html | |
Restore | |
mysql -u <user_name> -p db_name | |
mysql> source <full_path>/table_name.sql | |
or in one line | |
mysql -u username -p db_name < /path/to/table_name.sql | |
Dump and restore a single table from a compressed (.sql.gz) format | |
Credit: John McGrath | |
Dump | |
mysqldump db_name table_name | gzip > table_name.sql.gz | |
Restore | |
gunzip < table_name.sql.gz | mysql -u username -p db_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment