MySQL Tutorial master-slave sync failure last_io_error:got fatal Error 1236 from master solution
Encountered such errors as: "Last_io_error:got fatal error 1236 from master when reading the data from binary log: ' Could ' is not find ' e name in binary log index file ' ", etc. or due to the clearing of data caused the master and slave library is not synchronized, the solution is as follows:
First enter the slave to execute: "Slave stop;" To stop synchronizing from the library;
Then go to Master to execute: "Flush logs;" To clear the log;
Then execute in master: "Show master status;" View the status of the main library, mainly log files and position;
Then go back to Slave and execute: "Change master to master_log_file= ' log-bin.000004 ', master_log_pos=106;", File and location corresponding to master;
Finally in the slave: "Slave start;" To initiate synchronization.
about configuring master-slave MySQL server methods
1, two machines (mine is WinXP IP 192.168.0.119 from the primary server Win2003 192.168.0.17 Primary server)
2, in two machines installed MySQL database Tutorial Tutorial server (note: Preferably from the server version is higher than the master server version)
3, for the convenience of memory I call the main server 192.168.0.17 called 111cn.net-a, from the server 192.168.0.119 111cn.net-b machine
Home we configure the master server, create a database a111cnnet create a table test
Find the [mysqld] inside your my.ini to add below
Server-id =111 #唯一标识, as long as not the same from the server on the line.
Log-bin=mysql-bin #d:/mysql/log/#必须开启这里, tells the master server to log in binary
Binlog-do-db=a111cnnet # to synchronize the database, more can write multiple lines
Binlog-ignore-db=mysql #忽略的数据库, can write more than a line
Below, create an account on the 111cn.net-a so that 111cn.net-b can access the following.
Grant File,replication slave,replication client,super on *.* to backup2@ ' 192.168.0.119 ' identified by ' backup2 ';
So that we can create a
User name Backup2
Password backup2
Allow only 192.168.0.119 this machine to connect
Well, to 111cn.net-a configuration, here's a look at 111cn.net-b configuration.
1, find your my.ini open under [mysqld], add the following code
Server-id =112
master-host=192.168.0.17 #主服务器ip
Master-user=backup2 #主服务器mysql账号, created above
Master-password=backup2 #主服务器mysql密码, created above
Master-connect-retry=1 #如何服务器重新连接时间为60
Replicate-do-db=a111cnnet #需要备份数据库
Replicate-ignore-db=mysql #忽略的数据库
OK, the configuration is complete, restart 111cn.net-a restart 111cn.net-b, now perform show slave status in 111cn.net-b
Show
Slave_io_state waiting for Master to send event
slave_io_running Yes
slave_sql_running Yes
Indicates that the configuration has been successful.
Well, you can now create a table in 111cn.net-a, or add a record to see if the data is synchronized
If not, you remove the master.info from the 111cn.net-a and 111cn.net-b, reboot and try again.
For more details please see: http://www.111cn.net/database/mysql/35730.htm