Mysql master-slave synchronization failed Last_IO_Error: Got fatal error 1236 resolved from master

Source: Internet
Author: User
Tags mysql tutorial

Mysql tutorial master-slave synchronization failure Last_IO_Error: Got fatal error 1236 from master Solution

The following error occurs: "Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file', or the Master/Slave database is not synchronized due to data clearing. The solution is as follows:

First, go to slave and execute: "slave stop;" to stop slave database synchronization;

Run "flush logs;" in the master to clear logs;

Then execute "show master status;" in the master to check the status of the master database, mainly the log file and position;

Return TO the slave and run: "change master to MASTER_LOG_FILE = 'Log-bin.000004 ', MASTER_LOG_POS = 106;". The file and location correspond TO those in the master;

Finally, Run "slave start;" in slave to start synchronization.

How to configure a master-slave mysql Server

1. Two machines (My winxp ip 192.168.0.119 master server win2003 192.168.0.17)
2. Install the mysql database tutorial server on the two machines respectively (Note: The slave server version is better than the master server version)
3. In order to facilitate memory I call the master server 192.168.0.17 bKjia. c0m-a, from the server 192.168.0.119 bKjia. c0m-b Machine

On the homepage, we configure the master server and create a database a111cnnet to create the table test.

Find [mysqld] In Your my. ini and add

Server-id = 111 # unique identifier, as long as it is not the same as the slave server.
Log-bin = mysql-bin # d:/mysql/log/# Must be enabled here, telling the master server to use binary logs
Binlog-do-db = a111cnnet # the database to be synchronized. Multiple rows can be written.
Binlog-ignore-db = mysql # ignored database, multiple lines can be written

Create an account in bKjia. c0m-a so that bKjia. c0m-b can access the following.

Grant file, replication slave, replication client, super on *. * to backup2 @ '192. 168.0.119 'identified by 'backup2 ';

In this way, we create
Username backup2
Password backup2
Only connection to 192.168.0.119 is allowed.

Good to bKjia. c0m-a configuration, next look at bKjia. c0m-b Configuration

1. Find your my. ini and open it under [mysqld]. Add the following code:

Servers-id = 112
Master-host = 192.168.0.17 # master server ip Address
Master-user = backup2 # master server mysql account, created above
Master-password = backup2 # master server mysql password, created above
Master-connect-retry = 1 # how to set the server reconnect time to 60


Replicate-do-db = a111cnnet # back up the database
Replicate-ignore-db = mysql # ignored Database

Now the configuration is complete, restart bKjia. c0m-a and then start bKjia. c0m-b, And now run show slave status in bKjia. c0m-b

Display
Slave_io_state waiting for master to send event
Slave_io_running yes
Slave_ SQL _running yes

The configuration is successful.

Now you can create a table in bKjia. c0m-a or add a record to see if the data is synchronized.

If not, you delete the master.info in bKjia. c0m-a and bKjia. c0m-b, restart and try again.

For more details, see http://www.bKjia. c0m/database/mysql/35730.htm

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.