Problem solving method of master-slave synchronization in MySQL database

Source: Internet
Author: User

To view the status from the library:
Mysql>show slave statusg;
Where Slave_io_running:yes indicates whether the synchronization IO is running, Slave_sql_running:yes indicates whether the synchronization SQL is running, and Last_error indicates the content of the last error.
I ran into an error SQL today with the following contents:
Last_error:error ' Duplicate entry ' 14772680-15′for key ' PRIMARY ' on query. Default database: ' xxxxxxxx '. Query: ' UPDATE pre_forum_post SET position=position+ ' 14′where ' tid ' in (' 14772680′, ' 14773058′ ')
This statement caused an error from the library and slave SQL stopped.
Execute Mysql>set GLOBAL sql_slave_skip_counter=2; Skipping a conflicting record.
and then restart Slave.
Mysql>stop slave
Mysql>start slave

If you encounter Slave_io_running:no, the instructions are master-slave IO does not run up. Today, I found another long unused db in this case, he restarted. Www,111cn.net
The error message is:
[ERROR] Got fatal error 1236: ' Could not find the ' the ' the ' in ' binary Log index file '
From master when reading the data from binary log
View the status of the main library on the main library
Mysql>show Master status;
List A record, very simple information
+ —————— + ——— –+ ———— –+ —————— +
| File | Position | binlog_do_db | binlog_ignore_db |
+ —————— + ——— –+ ———— –+ —————— +
| mysql-bin.002323 |              121077462 |                  | |
+ —————— + ——— –+ ———— –+ —————— +
Then execute from the library:
Mysql>stop slave;
Mysql>change Master to master_log_file= ' mysql-bin.002323′,master_log_pos=121077462;
Mysql>start slave;
View the status from the library again
Mysql>show slave statusg;
Found normal.

Another encounter today is a strange phenomenon, that is, MySQL stopped after the start up. Error
Starting MySQL. error! Manager of Pid-file quit without updating file.
#/usr/bin/mysql_safe
Then it's normal, stop safe mode and start again.
#service MySQL Start

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.