First, backup
1. Back up a database
-U username-p dbname table1 table2 ... > backupname.sql
Example:
Mysqldump-u root-p owncloud > Owncloud.sql Where: The dbname parameter represents the name of the database, the Table1 and table2 parameters represent the name of the table that needs to be backed up, the entire database is empty, and the Backupname.sql parameter table designs The name of the backup file, preceded by an absolute path. Typically the database is partitioned into a file with a suffix called SQL;
2. Backing up multiple databases
-U username-p--databases dbname2 dbname2 > backup.sql #加上了--databases option, followed by multiple databases
-u root-p--databases owncloud mysql > backup.sql
-U username-p-all-databases > backupname.sql
-u-root-p-all-databases > All.sql
Second, data restoration
-U root-p [dbname]<-u root-p < backup.sql
Restore a backup of a direct copy directory: When restoring in this way, you must ensure that the version number of the two MySQL databases is the same. Tables of the MyISAM type are valid, and table spaces for InnoDB tables cannot be copied directly for tables that have INNODB types that are not available.
MySQL Data backup and restore