Places to be aware of:
1. Primary server (Master), from the server (slavethe version of the database cannot be exaggerated and can be minor version differences. But from the server'sMySQLversion try not to be less thanMasterof theMySQLversion. Responsible for the need toMasterJoin inBinlog-checksum = None (due to5.6used aCRC32doBinlogof theChecksum. In addition toMasterthe settings fromCRC32Change toNonIn general, this error code: Slave can not handle replication events with the checksum, master is configured to log
2. Masterusers who need to open a remote accessGrant all on * * to[email protected]Identified by "123"; ( Alldelegate has all permissions, can be set by itself, the first*represents a database,*is all the data. A second*represents a table under a database,*represent all tablesJackas username, you can name it yourself, 192.168.88.99AccessIP, if you want all theIPcan be accessed, you need to set the’%’。123It's your password,Password is not recommended too long, it is not recommended too short, because the database will be long passwords automatically intercepted, short passwords in the master-slave synchronization will have error messages);
3, master config Server-id = 1; log-bin=mysql-bin; or server_id=1; log_bin=mysql-bin; according to mysql version. server-id = 1; Log-bin=mysql-bin; turn on the server log file, this must be. Because the synchronization of data is based on the log file.
4, slave server-id=2; master-host= main server IP; master-user= previous account set
5, slave Read_master_log_pos must be synchronized with the current master , assuming that master 's postion in 10000, the read_master_log_pos=10000;Master_log_file must and the current Master log file synchronization
Questions to be studied:
1, assume master when the machine, now enable slave to read and write data, how to let the master server update the data. (The idea now is to export the log file from the service and then import it with the master server, provided that master has to reset Master again to ensure that the new log file is opened).
2, when the slave accidentally write operation, master-slave synchronization will no longer proceed.
General Operation:
Reset Master Clears all log files, default to mysql-bin.000001
Show Master status View current log file information
Stop slave stops master-Slave synchronization
Start slave begins master-slave synchronization
Change Master to .... setting configuration information from the server
Show slave status\g View configuration information from the server
Flush privileges Refresh permissions When you set the information to the user, the user permissions are modified, and the permissions must be refreshed
Flush logs flush log file, equivalent to generating a new log file
Show Master logs view log file information
MySQL master-Slave synchronization summary