Notice the result of the NOW() function in the following query. The query was run on a real database server and I didn’t change the clock of the server or change anything in the database configuration settings.
mysql> SELECT NOW(),SYSDATE(); +---------------------+---------------------+ | NOW() | SYSDATE() | +---------------------+---------------------+ | 1999-01-01 00:00:00 | 2012-11-29 05:50:03 | +---------------------+---------------------+ 1 row in set (0.00 sec)
You may proceed to party like it is 1999.
How can the NOW() function return a value in the past?
The “secret” is the TIMESTAMP variable, which is a special MySQL variable that can be set by the MySQL client. MySQL adds special events in the binary log which set the TIMESTAMP and INSERT_ID (which is used for AUTO_INCREMENT replication) to the correct values to ensure that statements replicate properly.
Here is …
[Read more]