まえがき 個人開発で SELECT NOW() したときに、UTC の日付時刻が返ってきたため修正する! 環境 WSL2 (Windows 10 64bit) Ubuntu 22.04.2 LTS docker compose MySQL 8.0.32 手順 docker-compose.yaml を編集 現状はこんな感じ version: '3.9' services: mysql: build: ./mysql volumes: - ./mysql/data:/var/lib/mysql ports: - "3306:3306" environment: - MYSQL_ROOT_PASSWORD=password version: '3.9' services: mysql: build: ./mysql volumes: - ./mysql/data:/var/lib/mysql
![docker compose で MySQL を動かすときのタイムゾーン指定方法](https://cdn-ak-scissors.b.st-hatena.com/image/square/139d8db078b3ac8da87ec524bb8bfb304a90128a/height=288;version=1;width=512/https%3A%2F%2Fres.cloudinary.com%2Fzenn%2Fimage%2Fupload%2Fs--gUmLl3K8--%2Fc_fit%252Cg_north_west%252Cl_text%3Anotosansjp-medium.otf_55%3Adocker%252520compose%252520%2525E3%252581%2525A7%252520MySQL%252520%2525E3%252582%252592%2525E5%25258B%252595%2525E3%252581%25258B%2525E3%252581%252599%2525E3%252581%2525A8%2525E3%252581%25258D%2525E3%252581%2525AE%2525E3%252582%2525BF%2525E3%252582%2525A4%2525E3%252583%2525A0%2525E3%252582%2525BE%2525E3%252583%2525BC%2525E3%252583%2525B3%2525E6%25258C%252587%2525E5%2525AE%25259A%2525E6%252596%2525B9%2525E6%2525B3%252595%252Cw_1010%252Cx_90%252Cy_100%2Fg_south_west%252Cl_text%3Anotosansjp-medium.otf_37%3Auepyon9%252Cx_203%252Cy_121%2Fg_south_west%252Ch_90%252Cl_fetch%3AaHR0cHM6Ly9saDMuZ29vZ2xldXNlcmNvbnRlbnQuY29tL2EvQUVkRlRwNE45dWc2SW9obFk2OXd6ZlF3T2RIUFRvZ0JteTNNOHN0Q0JwUU1lQT1zOTYtYw%3D%3D%252Cr_max%252Cw_90%252Cx_87%252Cy_95%2Fv1627283836%2Fdefault%2Fog-base-w1200-v2.png)