通过 PhPMyAdmin 在 MySql Server 上设置默认时区
我有一个共享托管 mySql 实例,它的 system_time_zone 设置为太平洋标准时间,time_zone 变量设置为 System,因此它实际上是在太平洋标准时间运行.
I have a shared hosting mySql instance which has it's system_time_zone set to Pacific Standard Time and it's time_zone variable set to System, hence effectively it's running on Pacific Standard Time.
即我已经运行以下命令来找出答案:
i.e. I've run the following command to find this out:
SELECT version( ) , @@time_zone , @@system_time_zone , NOW( ) , UTC_TIMESTAMP( )
我想将默认的 mySql 数据库/本地 mySql 数据库时区更改为 GMT/UTC 时间.我尝试运行,SET time_zone = '+0:00'
,这确实执行成功!
I would like to change the default mySql database / local mySql DB time-zone to GMT/UTC time. I tried to run, SET time_zone = '+0:00'
, and this does execute successfully!
但是,当我检查@@time_zone 的状态时,这似乎不会影响 time_zone 变量.我看过另一篇处理类似问题的帖子 如何在 Windows 和 Linux 中设置 MySQL 以使用 GMT,我还检查了 MySql 文档,进展甚微.由于我使用的是共享托管解决方案,因此我的访问权限有限,并且我无法访问比我的 PhPMyAdmin mySql 功能提供的更多内容.
However, this does not seem to affect the time_zone variable, when I check the state of @@time_zone. I've looked at another post dealing with similar issue How to set MySQL to use GMT in Windows and Linux and I also checked the MySql documentation, with little progress. Since I am on a shared-hosting solution, I have limited access and I don't have access to more than what my PhPMyAdmin mySql functionality has on offer.
我想知道是否有任何方法可以从 SQL 查询中更改 default_time-zone,或者我是否需要退回到命令行(很遗憾,我无权访问).
I wonder if there is any way to change the default_time-zone from within an SQL query, or do I need to fall back to the command line (to which I don't have access to, unfortunately).
感谢您的帮助和建议,
马丁
推荐答案
对于共享主机,您必须要求支持人员帮助您并为您更改默认时区?我与 Arcor 托管服务提供商有类似的问题,打电话给他们,他们修复了它.在此之前,我在 PHP 代码中的 date_default_timezone_set()
中找到了临时解决方案.可能最好的解决方案是请有权更改该参数的人.
For shared hosting, you have to ask support-guys to help you and change default time zone for you? I had similar problem with Arcor hosting-provider, called them and they fixed it. Before that, I found temporary solution in date_default_timezone_set()
from PHP code. Probably the best solution is to ask someone who has privilege to change that parameter.
相关文章