使用PHPMyAdmin为MySQL设置时区 [英] setting timezone for MySQL using PHPMyAdmin

查看:475
本文介绍了使用PHPMyAdmin为MySQL设置时区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,每当用户创建一个新帐户时,我就会创建一个Creation_date列,其数据类型为timestamp.目前,此时间戳比EST早3个小时(如果在波士顿,则为5PM,则为8PM).是否可以将时区更改为EST?当前设置为哪个时区?

Currently whenever a user creates a new account, I have a Creation_date column that has datatype timestamp. Currently this timestamp reads 3 hours ahead of EST (if it's 5PM in Boston it reads 8PM). Is there a way to change the timezone to EST? What timezone is it set to currently?

推荐答案

这与MySQL的时区有关.

This has to do with MySQL's timezone.

您可以使用以下方法针对每个连接(例如,通过PHPMyAdmin)进行设置:

You can set it per connection (e.g. via PHPMyAdmin) with the following:

SET time_zone = timezone;

但是,如果MySQL重新启动,这将重置.因此最好在服务器级别进行设置.我以为你做不到.

However, this will reset if MySQL restarts. So it is better set at the server level. Which, I assume, you can't.

我建议您从 MySQL文档中阅读更多内容.

这篇关于使用PHPMyAdmin为MySQL设置时区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆