MySQL master-slave synchronization failed Last_io_error:got fatal Error 1236 from master workaround

Source: Internet
Author: User
Tags mysql tutorial

MySQL Tutorial master-slave synchronization failed Last_io_error:got fatal Error 1236 from master workaround

This error is encountered such as: "Last_io_error:got fatal error 1236 from master when reading data from binary log: ' Could not ' find First log fil e name in binary log index file ' "or due to clear data cause master and slave libraries are not synchronized, the workaround is as follows:

Enter slave first to execute: "Slave stop;" To stop synchronizing from the library;

Then go to master in the execution: "Flush logs;" to empty the log;

Then execute in master: "Show master status;" View the status of the main library, mainly the log files and position;

Then go back to Slave, execute: "Change master to master_log_file= ' log-bin.000004 ', master_log_pos=106;", File and location corresponding to master;

Finally executed in slave: "Slave start;" To initiate synchronization.

About configuring the master-slave MySQL server method

1, two machines (my 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 main server version)
3, in order to facilitate memory I put the primary server 192.168.0.17 called 111cn.net-a, from the server 192.168.0.119 111cn.net-b machine

Home we configure the primary server, create a database a111cnnet create a table test

Find your My.ini inside [mysqld] add below

Server-id =111 #唯一标识, as long as the same as not from the server on the line.
Log-bin=mysql-bin #d:/mysql/log/#必须开启这里, tell the primary server to log in binary
Binlog-do-db=a111cnnet # The database to be synchronized, more than write multiple lines
Binlog-ignore-db=mysql #忽略的数据库, more than a few lines can be written

The following is to create an account on 111cn.net-a so that 111cn.net-b can access the following.

Grant File,replication slave,replication client,super on * * to [E- Mail protected]' 192.168.0.119 ' identified by ' Backup2 ';

So we can create a
User name Backup2
Password backup2
Only allow 192.168.0.119 this machine to connect

Well, to 111cn.net-a configuration, let's look at 111cn.net-b configuration.

1. Find your My.ini open in [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, and 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

Description 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 111cn.net-a and 111cn.net-b inside the master.info Delete, restart and try again

MySQL master-slave synchronization failed Last_io_error:got fatal Error 1236 from master workaround

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.