inline Dump and restore MySQL Database

Originally published on May 1st, 2020 (Last updated on May 1st, 2020)

To dump a data­base into a SQL file, use the fol­low­ing command:

mysqldump -u [user] -p[password] [database] > [file]

The com­mand will dump the SQL state­ments onto std-out, so we’re redi­rect­ing them into a file for save keep­ing. To resore a datab­se, use the fol­low­ing command:

mysql -u [user] -p[password] < [file]

This will sim­ply exe­cute all SQL instruc­tions placed in the file.

Comments

No com­ment sec­tion here 😄

You can reach me over at @knuth_dev or send me an Email.