備份MySQL數(shù)據(jù)庫的命令mysqldump -hhostname -uusername -ppassword databasename > backupfile.sql
備份MySQL數(shù)據(jù)庫為帶刪除表的格式 備份MySQL數(shù)據(jù)庫為帶刪除表的格式,,能夠讓該備份覆蓋已有數(shù)據(jù)庫而不需要手動刪除原有數(shù)據(jù)庫。
mysqldump -–add-drop-table -uusername -ppassword databasename > backupfile.sql
直接將MySQL數(shù)據(jù)庫壓縮備份mysqldump -hhostname -uusername -ppassword databasename | gzip > backupfile.sql.gz
備份MySQL數(shù)據(jù)庫某個(些)表mysqldump -hhostname -uusername -ppassword databasename specific_table1 specific_table2 > backupfile.sql
同時備份多個MySQL數(shù)據(jù)庫mysqldump -hhostname -uusername -ppassword –databases databasename1 databasename2 databasename3 > multibackupfile.sql
僅僅備份數(shù)據(jù)庫結(jié)構(gòu)mysqldump –no-data –databases databasename1 databasename2 databasename3 > structurebackupfile.sql
備份服務(wù)器上所有數(shù)據(jù)庫mysqldump –all-databases > allbackupfile.sql
還原MySQL數(shù)據(jù)庫的命令mysql -hhostname -uusername -ppassword databasename < backupfile.sql
還原壓縮的MySQL數(shù)據(jù)庫gunzip < backupfile.sql.gz | mysql -uusername -ppassword databasename
將數(shù)據(jù)庫轉(zhuǎn)移到新服務(wù)器mysqldump -uusername -ppassword databasename | mysql –host=*.*.*.* -C databasename