inline Dump and restore MySQL Database
Originally published on May 1st, 2020 (Last updated on May 1st, 2020)
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.