inline Dump and restore MySQL Database
To dump a database into a SQL file, use the following command:
mysqldump -u [user] -p[password] [database] > [file]
The command will dump the SQL statements onto std-out, so we’re redirecting them into a file for save keeping. To resore a databse, use the following command:
mysql -u [user] -p[password] < [file]
This will simply execute all SQL instructions placed in the file.