mysql time now,MySQL的NOW()遵循哪个时区

Does MySQL’s NOW() follow the system’s timezone or some standard like GMT or UTC?

解决方案

It’s in the current time zone. From the 5.1 docs:

Returns the current date and time as a

value in ‘YYYY-MM-DD HH:MM:SS’ or

YYYYMMDDHHMMSS.uuuuuu format,

depending on whether the function is

used in a string or numeric context.

The value is expressed in the current

time zone.

Now “the current time zone” can mean different things:

The system time zone

A time zone specified for the MySQL server in general

A connection-specific time zone

(The 5.4 docs look the same for these bits. Obviously consult the docs for the version you’re running for the best possible information.)