通过PhPMyAdmin在MySql服务器上设置默认时区 [英] Setting default-time-zone on MySql Server via PhPMyAdmin
问题描述
我有一个共享托管mySql实例,它的system_time_zone设置为太平洋标准时间,它的time_zone变量设置为系统,因此有效地运行在太平洋标准时间。
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.
ie我已经运行以下命令找到这个:
i.e. I've run the following command to find this out:
SELECT version( ) , @@time_zone , @@system_time_zone , NOW( ) , UTC_TIMESTAMP( )
我想更改默认的mySql数据库/本地mySql DB时间 - 区到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变量。我看过另一篇处理类似问题的帖子如何设置MySQL在Windows和Linux中使用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).
感谢您的帮助和建议,
Martin
推荐答案
对于共享主机,您必须请求支持人员帮助您并更改默认时区?我有类似的问题,Arcor hosting-provider,他们和他们固定它。在此之前,我在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.
这篇关于通过PhPMyAdmin在MySql服务器上设置默认时区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!