如何在没有管理员权限的情况下使用 PHPMyAdmin 更改 mysql 中的时区

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9798308/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 12:38:21  来源:igfitidea点击:

How can I change the timezone in mysql using PHPMyAdmin without admin permission

mysql

提问by red23jordan

I want to display

我要显示

SELECT NOW();

as Asia/Hong_Kong time. Please help...

作为亚洲/香港时间。请帮忙...

回答by Naveen Kumar

ASIA/HONG KONG is GMT+08:00

亚洲/香港为 GMT+08:00

mysql_query("SET SESSION time_zone = '+8:00'"); 

回答by mr_eclair

This way you can change time_zone in mysql.

这样您就可以在 mysql 中更改 time_zone。

SET time_zone = 'Asia/Hong_Kong';

For more reference

对于更多的参考

回答by sikander

You can specify the timezone in the my.ini config file as well.

您也可以在 my.ini 配置文件中指定时区。

See http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_time_zone

http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_time_zone

回答by Sébastien Bühl

In your file php.ini

在您的文件中 php.ini

[Date]<br />
; Defines the default timezone used by the date functions<br />
; http://php.net/date.timezone<br />
date.timezone ="Africa/Kigali"<br />

you need to change the timezone. Here is a list of timezone

您需要更改时区。 这是时区列表

回答by Syahmi Yusoff

SET time_zone = '+8:00';

This seems to work for me in MySQL GoDaddy server. Just change +8.00 (Asia/Kuala_Lumpur) to your country timezone.

这似乎在 MySQL GoDaddy 服务器中对我有用。只需将 +8.00 (Asia/Kuala_Lumpur) 更改为您所在国家/地区的时区。

回答by Syahmi Yusoff

Some MySQL servers may not have the TZ tables loaded - so using the format:

一些 MySQL 服务器可能没有加载 TZ 表 - 所以使用以下格式:

SET time_zone = "Asia/Hong Kong";

may not work, in which case you will have to instead use the UTC offset format., using a value i.e.

可能不起作用,在这种情况下,您将不得不改用 UTC 偏移格式。,使用一个值,即

SET time_zone = '+10:00';

Note: The UTC offset format by its very nature (that you are specifying the offset) doesn't automatically take into account Daylight Saving Times (whereas the named version does as the TZ - TimeZone - tables are loaded into MySQL with that info and are able to do lookups on the DST values).

注意:UTC 偏移量格式本质上(您指定偏移量)不会自动考虑夏令时(而命名版本会像 TZ - TimeZone - 表使用该信息加载到 MySQL 中,并且能够对 DST 值进行查找)。

回答by jericho morales

i use this, hope this coulkd help

我用这个,希望这可以帮助

<?php date_default_timezone_set("Asia/Manila"); ?>

maybe you could use ("Asia/Hong Kong") but not tested

也许你可以使用(“亚洲/香港”)但没有经过测试