公式説明は下記にあるのだが、多少トラップがある。
https://dev.mysql.com/doc/refman/5.7/en/time-zone-support.html
システムテーブルを書き換える
これを行わずに my.cnf にタイムゾーンを指定すると、mysqld が起動しなくなる。
既に DB を作り始めていると、-D を使って DB を指定する必要がある。
/usr/local/mysql-5.7.x-macos10.x-x86_64/bin/mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -h localhost -u root -p -Dmysql
OSX 10.14.6(18G95)では
Warning: Unable to load '/usr/share/zoneinfo/+VERSION' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
が出た。とりあえず無視。
起動して確認。
mysql> show variables like '%time_zone%'; +------------------+-------+ | Variable_name | Value | +------------------+-------+ | system_time_zone | JST | | time_zone | UTC | +------------------+-------+