Created
August 22, 2011 13:52
-
-
Save stream7/1162416 to your computer and use it in GitHub Desktop.
Backuping and restoring a single table using mysqldump
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
Backuping a single table from a database | |
mysqldump -u -p database_one -h host table_name > /var/www/backups/table_name.sql | |
Backuping a single table from a database with query | |
mysqldump -u #{user} -p#{pass} -h #{server} -nt --databases #{database} --tables #{table} --where="#{query}" > example.sql | |
mysqldump -u root -prootpass -h ssserver -nt --databases example_development --tables products --where="id > 7970001" > products.sql | |
-n -t for --no-create-db --no-create-info | |
mysqldump -u root -pmagrathea -h ssserver --no-create-db --no-create-info --databases marvin_real3 --tables products --where="id > 7970001" > pr2.sql | |
Restoring the table into another database | |
mysql -u -p -h host database_two < /var/www/backups/table_name.sql | |
default host is localhost |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment