Skip to content

Instantly share code, notes, and snippets.

@tomysmile
Last active October 30, 2015 00:34
Show Gist options
  • Save tomysmile/6da697d81a18cbabf2b6 to your computer and use it in GitHub Desktop.
Save tomysmile/6da697d81a18cbabf2b6 to your computer and use it in GitHub Desktop.
Mysql: Export Import

To export a mysql database (as a dump) from the command line run:

$ mysqldump database_name > database_exportname.sql
$ mysqldump -h hostname -u username -p wordpress > wordpress.sql

To export all databases:

$ mysqldump -A > all_dbs.sql
$ mysqldump --all-databases > all_databases_export.sql

To import one of these mysql databases from the dump into a database:

$ mysql -p -u user_name database_name < file.sql
$ mysql --one-database database_name < all_databases_export.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment