The free backup tools currently supported by MySQL are: mysqldump, mysqlhotcopy, and can be backed up with SQL syntax: Backup TABLE or SELECT into outfile, or backup binary log (binlog), It can also be a direct copy of the data file and the associated configuration file. MyISAM tables are stored in the form of files, so they are relatively easy to back up, and several of the above mentioned methods are available. Innodb All tables are stored in the same data file ibdata1 (or multiple files, or separate tablespace files), relatively difficult to backup, the free scheme can be copied data files, backup Binlog, or with mysqldump.
The code is as follows |
Copy Code |
Mysqldump--opt SCHOOL>SCHOOL.BBB
|
Comments:
Back up the database school to the school.bbb file, school.bbb is a text file, file name to take, open look you will
There are new discoveries.
Commands for backing up the MySQL database
The code is as follows |
Copy Code |
Mysqldump-hhostname-uusername-ppassword databasename > Backupfile.sql |
Backing up the MySQL database for a deleted table format
Backing up the MySQL database is a format with a deleted table that allows the backup to overwrite the existing database without having to manually delete the original database.
The code is as follows |
Copy Code |
Mysqldump-–add-drop-table-uusername-ppassword databasename > Backupfile.sql |
Directly compress MySQL database to backup
The code is as follows |
Copy Code |
Mysqldump-hhostname-uusername-ppassword DatabaseName | gzip > backupfile.sql.gz |
Backing up a MySQL database (some) tables
The code is as follows |
Copy Code |
Mysqldump-hhostname-uusername-ppassword databasename specific_table1 specific_table2 > Backupfile.sql |
Backup multiple MySQL databases at the same time
The code is as follows |
Copy Code |
Mysqldump-hhostname-uusername-ppassword–databases databasename1 databasename2 databasename3 > Multibackupfile.sql |
Just back up the database structure
Mysqldump–no-data–databases databasename1 databasename2 databasename3 > Structurebackupfile.sql Backup
All databases on the server
The code is as follows |
Copy Code |
Mysqldump–all-databases > Allbackupfile.sql |
command to restore MySQL database
The code is as follows |
Copy Code |
Mysql-hhostname-uusername-ppassword DatabaseName < Backupfile.sql |
Restoring a compressed MySQL database
The code is as follows |
Copy Code |
Gunzip < backupfile.sql.gz | Mysql-uusername-ppassword DatabaseName |
Transferring a database to a new server
code is as follows |
copy code |
Mysqldump- Uusername-ppassword DatabaseName | Mysql–host=*.*.*.*-c databasename |