MySQL master-slave replication configuration encountered problems

Source: Internet
Author: User

Errors encountered while making configuration from the server.

mysql> Change Master to master_host= ' 192.168.136.129 ', master_user= ' repl ', master_password= ' 123456 ', Master_log_ File= ' mysql-bin.000003 ', master_log_pos=2610;

ERROR 1201 (HY000): Could not initialize master info structure; More error messages can is found in the MySQL error log


View Logs

[Email protected] mysql]# ls-a

. Ib_logfile0 relay-log.info slave-relay-bin.000002 slave-relay-bin.000006 slave-relay-bin.000010 slave-relay-b in.000014

.. Ib_logfile1 slave.err slave-relay-bin.000003 slave-relay-bin.000007 slave-relay-bin.000011 slave-relay-b In.index

Discuz master.info slave.pid slave-relay-bin.000004 slave-relay-bin.000008 slave-relay-bin.000012 test

ibdata1 MySQL slave-relay-bin.000001 slave-relay-bin.000005 slave-relay-bin.000009 slave-relay-bin.000013


[Email protected] etc]# Tail/data/mysql/slave.err

Version: ' 5.1.40 ' socket: '/tmp/mysql.sock ' port:3306 mysql Community Server (GPL)

141103 15:42:29 mysqld_safe A mysqld process already exists

141103 16:48:32 [ERROR] Failed to open the relay log './localhost-relay-bin.000001 ' (Relay_log_pos 4)

141103 16:48:32 [ERROR] Could not find target log during relay log initialization

141103 16:49:51 [ERROR] Failed to open the relay log './localhost-relay-bin.000001 ' (Relay_log_pos 4)

141103 16:49:51 [ERROR] Could not find target log during relay log initialization

141103 16:49:52 [ERROR] Failed to open the relay log './localhost-relay-bin.000001 ' (Relay_log_pos 4)

141103 16:49:52 [ERROR] Could not find target log during relay log initialization

141103 16:49:53 [ERROR] Failed to open the relay log './localhost-relay-bin.000001 ' (Relay_log_pos 4)

141103 16:49:53 [ERROR] Could not find target log during relay log initialization


Solve:

Due to the previous configuration, some *relay* have been generated, so that the configuration can not be generated again, delete the previously generated files.

[Email protected] mysql]# RM *bin*

RM: Do you want to delete the generic file "slave-relay-bin.000001"? Y

RM: Do you want to delete the generic file "slave-relay-bin.000002"? Y

RM: Do you want to delete the generic file "slave-relay-bin.000003"? Y

RM: Do you want to delete the generic file "slave-relay-bin.000004"? Y

RM: Do you want to delete the generic file "slave-relay-bin.000005"? Y

RM: Do you want to delete the generic file "slave-relay-bin.000006"? Y

RM: Do you want to delete the generic file "slave-relay-bin.000007"? Y

RM: Do you want to delete the generic file "slave-relay-bin.000008"? Y

RM: Do you want to delete the generic file "slave-relay-bin.000009"? Y

RM: Do you want to delete the generic file "slave-relay-bin.000010"? Y

RM: Do you want to delete the generic file "slave-relay-bin.000011"? Y

RM: Do you want to delete the generic file "slave-relay-bin.000012"? Y

RM: Do you want to delete the generic file "slave-relay-bin.000013"? Y

RM: Do you want to delete the generic file "slave-relay-bin.000014"? Y

RM: Do you want to delete the generic file "Slave-relay-bin.index"? Y

[Email protected] mysql]# ls-a

.  .. Discuz ibdata1 ib_logfile0 ib_logfile1 master.info mysql relay-log.info slave.err slave.pid test

[Email protected] mysql]# RM relay-log.info

RM: Do you want to delete the generic file "Relay-log.info"? Y

[Email protected] mysql]# RM master.info

RM: Do you want to delete the generic file "Master.info"? Y

[Email protected] mysql]# ls-a

.  .. Discuz ibdata1 ib_logfile0 ib_logfile1 mysql slave.err slave.pid test


[Email protected] mysql]#/usr/local/mysql/bin/mysql-uroot

Welcome to the MySQL Monitor. Commands End With; or \g.

Your MySQL Connection ID is 8

Server version:5.1.40 MySQL Community Server (GPL)


Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.


mysql> slave stop;

Query OK, 0 rows affected, 1 Warning (0.00 sec)

mysql> Change Master to master_host= ' 192.168.136.129 ', master_user= ' repl ', master_password= ' 123456 ', Master_log_ File= ' mysql-bin.000003 ', master_log_pos=2610;

Query OK, 0 rows affected (0.06 sec)


mysql> slave start;

Query OK, 0 rows affected (0.03 sec)



No more error, configuration success!

In addition, found in the Master.info file is the configuration of their own options.

This article is from the "Learning" blog, so be sure to keep this source http://tyl00.blog.51cto.com/6576378/1571338

MySQL master-slave replication configuration encountered problems

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.