LAST_INSERT_ID()
A is the host, B is the backup machine, and is also a dual-nic, and can be connected through the Intranet
A Intranet IP Address: 192.168.195.28
B Intranet IP Address: 192.168.195.30
The database version (5.0.22), directory, initial database, and table are the same.
Database ad_data, alexa_info, log_db, oblog, union_db, zm0061_db to be backed up
MySQL and test databases that do not need to be backed up
Statement
1. Add the account mysqlrepl to the host as the backup account
Grant replication slave on *. * To 'mysqlrepl' @ '192. 168.195.30 'identified by '123 ';
For versions earlier than 4.02
Grant file on *. * To 'mysqlrepl' @ '192. 168.195.30 'identified by '123 ';
Then let the databases of the two machines shut down and lock the table. But for the direct purpose, I didn't play that deep.
2. Modify/data/8le8le/database/statusdb/CNF/my-status.cnf on machine
# Log name
Log-bin = mysql-bin
# Master server ID
Server-id = 1
# Databases to be backed up
BINLOG-do-DB = ad_data
BINLOG-do-DB = alexa_info
BINLOG-do-DB = log_db
BINLOG-do-DB = oblog
BINLOG-do-DB = union_db
BINLOG-do-DB = zm0061_db
# Ignored Database
BINLOG-ignore-DB = MySQL
BINLOG-ignore-DB = test
3. Modify/data/8le8le/database/statusdb/CNF/my-status.cnf on machine B
# Log name
Log-bin = mysql-bin
# Slave server ID
Server-id = 2
# IP address or domain name of the master server
Master-host = 192.168.195.28
# Master database port number
Master-Port = 30001
# Database Synchronization users
Master-user = mysqlrepl
# Synchronize database passwords
Masters-Password = 123456789
# Time Difference in reconnection if the master server is disconnected from the slave server
Master-connect-retry = 60
# Databases to be backed up
Replicate-do-DB = ad_data
Replicate-do-DB = alexa_info
Replicate-do-DB = log_db
Replicate-do-DB = oblog
Replicate-do-DB = union_db
Replicate-do-DB = zm0061_db
# Ignored Database
Replicate-ignore-DB = MySQL
Replicate-ignore-DB = test
4. Start the master server and start the slave server
Attach the B server to the database
Mysql> show slave status/g;
Two rows are displayed.
Slave_io_running: Yes
Slave_ SQL _running: Yes