Export Database (mysqldump):
Export database: Mysqldump-u user name-p database name > exported file name
mysqldump-uroot-pgameol32! Lottery >/home/lottery.sql (Enter the password to start exporting the database)
(If you export a single table, enter the table name after the database name)
Synchronize the exported database. sql file to the server on which you want to import (rsync):
Rsync-av/home/lottery.sql 10.10.86.100:/home/
The target server needs to turn on the firewall, put the IP, Port 22, protocol TCP
The target server needs to turn on sshd, allowing the root user, password login (for servers that only allow key logins)
Import Database (source):
mysql-uroot-pgameol32!
MySQL use lottery; Select a database,
If you are synchronizing on the basis of a previous original library,
Two methods: 1. Incremental update. 2. Delete the original library lottery drop, and then lottery from the new library, or the data will be imported incorrectly
SOURCE/HOME/LOTTERY.SQL specifies the absolute path of the. sql file being imported.
Import Method 2:
cd/data/mariadb/
Mysql-uroot-p lottery
MySQL Export and import data Mysqldump,source