Skip to content

Instantly share code, notes, and snippets.

@fraank
Last active August 29, 2015 14:09
Show Gist options
  • Save fraank/a8a9db589f56379db027 to your computer and use it in GitHub Desktop.
Save fraank/a8a9db589f56379db027 to your computer and use it in GitHub Desktop.
mysql console
# Export one table from database:
mysqldump -u root -p db_with_data table1 > /your/path/newsql.sql
# .. and import it again to another db:
mysql -u username -p -D db_without_data < /your/path/newsql.sql
if you need some encoding you can add "--default-character-set=UTF8"
#You can also connect directly into mysql and set the source:
mysql –h <host_name> -port=3306 –u <db_master_user> -p
mysql> source backup.sql;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment