MySQL is an open source relational database management system (RDBMS) that uses the most commonly used database management language-Structured Query Language (SQL) for database management.
E.g:
Database address: 127.0.0.1
Database user name: root
Database password: pass
Database name: myweb
1. Backup
database to D drive and directory
mysqldump-h127.0.0.1-uroot-ppass myweb>d:/backupfile.sql
2. Back up to the current directory The backup
MySQL database is in the format with deleted tables, which can make the backup overwrite the existing database without manually deleting the original database
mysqldump--add-drop-table -h127.0.0.1 -uroot -ppass myweb> backupfile.sql
3. Directly compress and backup the MySQL database to the D drive and the directory
mysqldump-h127.0.0.1-uroot-ppass myweb|gzip>d:/backupfile.sql.gz
4. Back up a certain table(s) of the MySQL database. This example backs up table1 and table2. Back up to /home on the linux host
mysqldump-h127.0.0.1-uroot-ppass myweb table1 table2>/home/backupfile.sql
5. Back up multiple MySQL databases at the same time
mysqldump-h127.0.0.1-uroot-ppass--databases myweb myweb2> multibackupfile.sql
6. Only backup the database structure. Back up the database named myweb and the database named myweb2 at the same time
mysqldump--no-data -h127.0.0.1 -uroot -ppass --databases myweb myweb2> structurebackupfile.sql
7. Back up all databases on the server
mysqldump--all-databases -h127.0.0.1 -uroot -ppass> allbackupfile.sql
8. The command to restore the MySQL database. Restore the current backup database named backupfile.sql
mysql-h127.0.0.1-uroot-ppass myweb
9. Restore the compressed MySQL database
gunzip
10. Transfer the database to the new server. This example is to copy the local database myweb to the remote database named serweb, and the remote database must have a database named serweb
mysqldump-h127.0.0.1-uroot-ppass myweb|mysql--host=***.***.***.*** -u database user name -p database password -C serweb