假设您使用的是 5.5,如果您看到 http://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html,它会说:
mysql> SET time_zone = timezone;
它还说:
The current session time zone setting affects display and storage of time values that are zone-sensitive. This includes the values displayed by functions such as NOW() or CURTIME(), and values stored in and retrieved from TIMESTAMP columns. Values for TIMESTAMP columns are converted from the current time zone to UTC for storage, and from UTC to the current time zone for retrieval.
The current time zone setting does not affect values displayed by functions such as UTC_TIMESTAMP() or values in DATE, TIME, or DATETIME columns. Nor are values in those data types stored in UTC; the time zone applies for them only when converting from TIMESTAMP values. If you want locale-specific arithmetic for DATE, TIME, or DATETIME values, convert them to UTC, perform the arithmetic, and then convert back.
所以在没有SESSION 的情况下尝试一下,看看它是否有效,并检查select @@session.time_zone;
是否为您提供了正确的时区。
编辑:您的数据库可能只是有问题。我刚刚在我的一个数据库(5.5.8)上尝试了这个并且它有效,但它在 5.0.51 上失败了。所以你可能需要升级数据库。
mysql> select CURRENT_TIMESTAMP();
+---------------------+
| CURRENT_TIMESTAMP() |
+---------------------+
| 2011-05-29 14:33:06 |
+---------------------+
1 row in set (0.00 sec)
mysql> set time_zone = 'Europe/Rome';
Query OK, 0 rows affected (0.00 sec)
mysql> select CURRENT_TIMESTAMP();
+---------------------+
| CURRENT_TIMESTAMP() |
+---------------------+
| 2011-05-29 16:33:11 |
+---------------------+
1 row in set (0.00 sec)
mysql> select version();
+-----------+
| version() |
+-----------+
| 5.5.8-log |
+-----------+
1 row in set (0.00 sec)