Skip to content

Instantly share code, notes, and snippets.

@cy-park
Created February 17, 2016 03:17
Show Gist options
  • Save cy-park/5133c830aee440166ee4 to your computer and use it in GitHub Desktop.
Save cy-park/5133c830aee440166ee4 to your computer and use it in GitHub Desktop.
Export and import MySQL Database

Export & import MySQL Database

This process requires 'mysqldump', a freeware to backup mysql databases.

Export data from MySQL DB to file

$ mysqldump -u [db_username] -p[db_password] [db_name] > [file_name]

Import data from file to MySQL DB

$ mysql -u [db_username] -p[db_password] [db_name] < [file_name]

MySQL access command

$ mysql -u [db_username] -p[db_password] -D [db_name]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment