Environment: centos7, mysql
Backup:
mysqldump -u root -p YHC> /home/yhc.sql
root as the user name, yhc for the database name, the command will execute database backup path to yhc.sql at home
A table backup:
mysqldump -u root -p YHC the User> /home/user.sql
the User table name
Compressed backup:
mysqldump -u root -p YHC | gzip> /home/yhc.sql.gz
mysqldump -u root -p YHC the User | gzip> /home/user.sql.gz
Restore:
MySQL -u YHC the root -p </home/yhc.sql
or gz extracting file, the commands are executed. Unzip: gzip -d yhc.sql.gz