Get the App
SLTechnology News&Howtos  ›  Database  › 

The difference between now and sysdate in mysql

Shulou Source: shulou.com Published: 2022-06-01 14:52:29 11月15日 Update

In mysql, now gets the execution time of sql, and sysdate gets the system time.

In the master-slave process of master and slave, it will lead to time inconsistency and error reporting.

For example:

Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.

Solution:

1. Fix this problem.

2. Instead of using the statement-level replication of statement, but similar to oracle, record the data changes and execute them in the standby database as is.

The second way is the well-known way of binlog_format=ROW. The first is that now () does not use machine system time, but takes the variable "TIMESTAMP" value of mysql.

Other similar variables include insert_id (the value of AUTO_INCREMENT for replication), and so on.

Tags: Time variables that is way system but consistent master-slave method as-is data machine level statement process problem Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker vpn MariaDB Xiaomi OPPO Reno