Summary of database migration requirements: migrate data from database database1 on the remote server IP Address: 172.10.10.1 to the database database2 table on the server IP Address: 172.10.10.2, the required field must correspond to 1. log on to the remote server locally and download data.
Remotely log on to the server ssh 172.10.10.1 and view the mysql process ps-ef | grep mysql on this server. // one server may have multiple mysql processes, the port and sock file are used to distinguish the mysql server/home/work/oem/mysql_oem/bin/mysql-h localhost-uroot-P 3307 -- socket =/home /work/oem/mysql_oem/mysql. sock checks the encoding format of data on mysql Server 3307. show variables like 'character % '; view the database show databases on mysql Server 3307 and dump the data on the mysql server with port 3307 according to latin1 encoding/home/work/oem/mysql_oem/bin/mysqldump -- de Fault-character-set = latin1-h localhost-uroot-P 3307 -- socket =/home/work/oem/mysql_oem/mysql. sock database1> ~ /Oem/redmine_oem/public/database1. SQL
Similarly, the database database2 table in 172.10.10.2 is migrated locally.
Download database1. SQL to the local wget url and create the database create schema database1 locally. Import the data to the local database database1. mysql-uroot-p ***-hlocalhost database1
According to requirements, corresponding fields are matched
A) Insert ...... select ..... from .. b) update ..... set .... where... c) substring (string, pos) The substring d from the pos position of string) concat (string1, string2): connect string1 to string2
3. If the local migration is successful, go online a) back up the online system B) view the target database c) Perform a series of local operations