MySQL – How to Back Up and Restore a Database

Declarations

Database: [dbname]
User: [uname]
Password: [pass]

Back up

Back up a dedicated database from the Command Line:

Back up all the databases:

Back up with Compress:

 

Restore

1. Create an appropriately named database on the target machine
2. Create an appropriately named user on the target machine

3a. Import an uncompressed SQL dump

3b. Import a compressed SQL dump