MySQL: Unsafestatementwrittentothebinarylogusingstate_MySQL

Source: Internet
Author: User
This article mainly introduces MySQL: UnsafestatementwrittentothebinarylogusingstatementformatsinceBINLOG_FORMATSTATEM. For more information, see 1: a large number of error logs

150602 14:40:02 [Warning] Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... SELECT... on duplicate key update is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are updated. this order cannot be predicted and may differ on master and the slave. statement: insert into tab_name
  

2: cause:

Check the cause. the tab_name table has two unique keys. INSERT... On duplicate key update, and the current database binlog_format is in statement format, this SQL statement will report unsafe.
  

Official Manual:

INSERT... On duplicate key update statements on tables with multiple primary or unique keys. when executed against a table that contains more than one primary or unique key, this statement is considered unsafe, being sensitive to the order in which the storage engine checks the keys, which is not deterministic, and on which the choice of rows updated by the MySQL Server depends.
  

Solution:

Set binlog_format to ROW or STATEMENT or modify SQL.

Under normal circumstances is mysql configuration problem, you can refer to this article: http://www.bitsCN.com/article/84357.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.