MYSQLL provides a mysqldump command that we can use to back up data.
Follow the prompts to enter the password, this will be the ABC database all the table structure and data back to Abc_20161108.sql,
# mysqldump-u ROOT-P ABC > Abc_20161108.sql
Because you want to always do backup work, if the data volume conference occupies a lot of space, then you can use gzip to compress the data, the command is as follows:
# mysqldump-u root-p TABC m | gzip > abc_20161108.sql.gz
The system crashes, and when you rebuild the system, you can recover data like this:
# mysqldump-u ROOT-P ABC < Abc_20161108.sql
To restore directly from a compressed file:
#gzip < abc_20161108.sql.gz | Mysqldump-u root-p ABC
Of course, there are a lot of MySQL tools to provide more intuitive backup recovery, such as the use of phpMyAdmin is very convenient.
But I think that mysqldump is the most basic and most universal.
As an automated GUI or interface test that generates data such as registration, you can use a script to back up the database before the test executes, perform a restore after each test, and delete the backup.
If the data confirmation will be persistent, you can remove the last step of deleting the backup.
MySQL Backup and restore