mysql backup and migration data synchronization method

  • 2020-05-09 19:26:53
  • OfStack

Recently, however, this visualization operation has been found to be a little problematic. When the number of data bars exceeds 1, EMS SQL Manager will fail. I don't know whether it is a software problem or not. Of course I started by breaking large database files into smaller files and importing them multiple times.
I just found out that my colleague used mysql's built-in mysqldump tool, which does not have this problem. (shame on you, but I don't have much access to the database.)
Here's how to do it:
1. Enter the bin directory and execute the command:
mysqldump -hlocalhost -uroot -padmin local_db > a.sql
2. The a.sql file has been generated in the bin directory.
mysql remote_db < a.sql 110.110.110.110 -uroot -padmin

Below is the principle of synchronization, the need of friends can refer to the next.
1. backup/dump ur local database at 1:00 am and
2. ftp the sql script to the server side with a bash script at 2:00 am
3. load the sql script in the server side at 3:00 am.

I don't think it's been made very clear. :)
Your question is much more relaxed than the one at the top.
1. Backup the local database first, cronjob for unix/linux, schedule for windows, schedule for windows
Start the backup bash or bat files at 1:00 a.m

2. Backing up a database can take quite a while, so make it 2 a.m. and launch another bash/bat file, which says
On ftp, no more than 5 lines can be used to upload the backup file to server, which also takes a period of time

3. Start the third bat/bash file at 3 o 'clock on server and load the uploaded file into the database.

Related articles: