61
60

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MySQLのTimeZoneをJSTからUTCに変更する

Last updated at Posted at 2014-08-15

環境

OSX 10.9.3
brew版 mysql

問題

SELECT NOW();の結果がJSTになってしまっている。

設定

現状の設定を確認する

mysql> show variables like '%time_zone%';

出力結果

+------------------+--------+
| Variable_name    | Value  |
+------------------+--------+
| system_time_zone | JST    |
| time_zone        | SYSTEM |
+------------------+--------+

設定ファイルの修正

$ vi ~/.my.cnf
my.cnf
[mysqld_safe]
timezone = UTC

再起動

$ mysql.server reload
SUCCESS! Reloading service MySQL

確認

mysql> show variables like '%time_zone%';

出力結果

+------------------+--------+
| Variable_name    | Value  |
+------------------+--------+
| system_time_zone | UTC    |
| time_zone        | SYSTEM |
+------------------+--------+
61
60
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
61
60

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?