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

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

问题描述

目前,每当用户创建新帐户时,我都会有一个数据类型为 timestamp 的 Creation_date 列.目前,此时间戳比美国东部标准时间早 3 小时(如果在波士顿是下午 5 点,则为晚上 8 点).有没有办法将时区更改为 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天全站免登陆