Mysql:unsafe statement written to the binary log using statement format since = Binlog_format

Source: Internet
Author: User

1: Error log mass error

150602 14:40:02 [Warning] Unsafe statement written to the binary log using statement format since Binlog_format = Statemen T. INSERT ... SELECT ... On DUPLICATE KEY UPDATE are unsafe because the order of which rows are retrieved by the SELECT determines which (if any) RO WS are updated. This order cannot is predicted and may differ on the master and the slave. Statement:insert into Tab_name
  

2: Reason:

Look for the reason, tab_name there are 2 unique keys on this table. Then use Insert ... On DUPLICATE KEY UPDATE, and the current database Binlog_format is in statement format, this SQL statement is reported unsafe.
  

Official Handbook:

INSERT ... On DUPLICATE KEY UPDATE statements on the tables with multiple primary or unique keys. When executed against a table which contains more than one primary or unique key, this statement is considered unsafe, bein G Sensitive to the "order" in which the storage engine checks the keys, which isn't deterministic, and on which the choice of rows updated by the MySQL Server depends.
  

Workaround:

Set the Binlog_format to row or statement or modify SQL.

Under normal circumstances is the MySQL configuration problem, you can refer to this article: http://www.jb51.net/article/84357.htm

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.