Skip to content

Instantly share code, notes, and snippets.

@dipanshuchaubey
Last active January 28, 2020 17:14
Show Gist options
  • Save dipanshuchaubey/dc362cedfd9b07ab06c21f6b73febcbb to your computer and use it in GitHub Desktop.
Save dipanshuchaubey/dc362cedfd9b07ab06c21f6b73febcbb to your computer and use it in GitHub Desktop.
Import, Export MySQL Database from Console

Importing a Database

To import a sql database using terminal, use this command:

$ mysql -u username -p -h localhost DATABASE_NAME < file_name.sql

Exporting a Database

To export a database, use the following command:

$ mysqldump -u username -p DATABASE_NAME > file_name.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment