The following describes how to back up the tables in a specific mysql database to a local .sql file, and directly compress the source table during this process to reduce storage space occupation
Backup:
mysqldump -h 192.168.1.32 -P3306 -uroot -pway123 testdb test | gzip > test.sql.gz
restore
gunzip < test.sql.gz | mysql -uroot -pway123 -h 192.168.1.32 -P3306 testdb
The variable parameters in the above command are:
The IP where the database table is located: 192.168.1.32
Database port number: 3306
Username: root
User password: way123
Where the database: testdb
Target table: test
File name: test.sql.gz (test is the table name, .sql format file, .gz compressed file format)
Note: On which server the file is to be backed up, where to execute the above backup command, provided that the two IPs can communicate