Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I use mysql replication. At slave, i read in aa.err Statement may not be safe to log in statement format. Statement: update idv_product set visit = visit+1 where id = '173' limit 1 I don`t understad, guide me about error above.

share|improve this question

closed as not a real question by quanta, sam, Iain, MDMarra, Scott Pack Nov 11 '11 at 23:25

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

3  
Please take the time to redact your question in a clear and understandable way. –  Stephane Nov 11 '11 at 9:41
add comment

1 Answer

That error message happens because the statement relies on the order that the records are stored on disk. There are a few things you can do to stop the error happening:

  1. Use row-based replication or mixed replication instead of statement based replication.
  2. Make sure the field you are using in the WHERE clause is the primary key (I don't think unique keys are enough to stop the error message even though they are adequate to stop the error.)
  3. Remove the LIMIT 1 clause from the query. If id is unique then the query will still only update one row.
  4. Use an ORDER BY clause on a unique key in the affected queries. This doesn't make sense for the query you supplied but does for certain other queries that cause this error message.

Some more reading on this error message.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.