How to Create a MySQL database backup snapshot and restore it

Sometimes you want to create a snapshot of the site database at a specific point in time, and then do some modifications and if anything has gone wrong restore that snapshot

To create a database snapshot run the following command

 mysqldump --add-drop-table -u mysqluser -p database_name > ~/db_name_date_time.sql

To restore that snapshot run the following command

mysql -u mysqluser -p database_name < ~/db_name_date_time.sql

You can also take a snapshot of the site directory using the command