Instantly share code, notes, and snippets.

Embed
What would you like to do?
Create and import MySQL / MariaDB dump

Create a MySQL / MariaDB dump on command line

mysqldump -u [uname] -p db_name > db_backup.sql

Import a dump into MySQL / MariaDB

mysql -u username -p db_name < db_backup.sql

Additional info When you create the dump the file db_backup.sql will be created in your current working directory. If you do not want to use your current directory make use of an absolute path. Importing the dump will take the file from the current working directory. If you do not want to use your current directory make use of an absolute path.

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