MySQL:在my.cnf选项文件中设置time_zone [英] MySQL: setting time_zone in my.cnf options file
本文介绍了MySQL:在my.cnf选项文件中设置time_zone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在MySQL中,您可以设置一个名为 time_zone 的会话变量来更改时区.这很有用,例如查看其他国家/地区的时间戳记时.这是一个示例:
In MySQL you can set a session variable called time_zone to change the timezone. This is useful e.g. when looking at timestamps from another country. Here is an example:
mysql> select now();
+---------------------+
| now() |
+---------------------+
| 2010-12-30 18:59:18 |
+---------------------+
1 row in set (0.00 sec)
mysql> set time_zone='Brazil/East';
Query OK, 0 rows affected (0.00 sec)
mysql> select now();
+---------------------+
| now() |
+---------------------+
| 2010-12-30 09:59:29 |
+---------------------+
1 row in set (0.00 sec)
是否可以将其放入选项文件中,例如.my.cnf?
Is it possible to put that in an option file e.g. .my.cnf ?
当我尝试时,它不起作用.我得到的是:
When I try, it doesn't work. All I get is:
mysql: unknown variable 'time_zone=Brazil/East'
推荐答案
应为
default_time_zone=Brazil/East
详细信息: http://dev. mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_time_zone
选项文件格式= default_time_zone
Option-File Format = default_time_zone
这篇关于MySQL:在my.cnf选项文件中设置time_zone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文