Skip to content

Instantly share code, notes, and snippets.

@biswajitpaul01
Last active October 14, 2018 13:32
Show Gist options
  • Save biswajitpaul01/83ec086605cb3a223de82f9182365bdd to your computer and use it in GitHub Desktop.
Save biswajitpaul01/83ec086605cb3a223de82f9182365bdd to your computer and use it in GitHub Desktop.
Mysql Database import expost
### Ref 1: https://www.tecmint.com/transfer-mysql-databases-from-old-to-new-server/
### Ref 2: http://osxdaily.com/2017/01/19/export-import-all-mysql-databases/
# Export all MySQL Databases to Dump File
> mysqldump -u [user] -p –all-databases > all_databases.sql
# If you want to dump a single database
> mysqldump -u root -p --opt [database name] > database_name.sql
# Transfer MySQL Databases Dump File to New Server
> scp all_databases.sql [email protected]:~/ [All Databases]
> scp database_name.sql [email protected]:~/ [Single Database]
# Import MySQL Databases Dump File to New Server
> mysql -u [user] -p –all-databases < all_databases.sql [All Databases]
> mysql -u [user] -p newdatabase < database_name.sql [Single Database]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment