Skip to content

Instantly share code, notes, and snippets.

@zh-f
Created September 1, 2016 05:58
Show Gist options
  • Save zh-f/5555855e17cc80925402532dfad82cd9 to your computer and use it in GitHub Desktop.
Save zh-f/5555855e17cc80925402532dfad82cd9 to your computer and use it in GitHub Desktop.
Exporting and importing an individual MySQL table
  • Exporting the Table To export the table run the following command from the command line:
mysqldump -p --user=username dbname tableName > tableName.sql

This will export the tableName to the file tableName.sql.

  • Importing the Table To import the table run the following command from the command line:
mysql -u username -p -D dbname < tableName.sql

The path to the tableName.sql needs to be prepended with the absolute path to that file. At this point the table will be imported into the DB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment