mysql 时区设置
生活随笔
收集整理的這篇文章主要介紹了
mysql 时区设置
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
前言
- mysql 5.7.31
- jdk 1.8
查看默認(rèn)時區(qū)
mysql> show variables like '%time_zone%'; +------------------+--------+ | Variable_name | Value | +------------------+--------+ | system_time_zone | UTC | | time_zone | SYSTEM | +------------------+--------+ 2 rows in set (0.00 sec)當(dāng)前會話設(shè)置時區(qū)
mysql> set time_zone='+8:00'; mysql> show variables like '%time_zone%'; +------------------+--------+ | Variable_name | Value | +------------------+--------+ | system_time_zone | UTC | | time_zone | +08:00 | +------------------+--------+ 2 rows in set (0.00 sec)- 在當(dāng)前會話中設(shè)置時區(qū),僅對當(dāng)前會話有效。
全局設(shè)置時區(qū)
mysql> set global time_zone='+8:00';- 退出當(dāng)前會話,在新開的會話生效。
配置文件my.cnf修改時區(qū)
[mysqld] default-time_zone = '+8:00'- 修改my.cnf需要重啟MySQL
總結(jié)
以上是生活随笔為你收集整理的mysql 时区设置的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【Centos 8】【Centos 7】
- 下一篇: 日本科研掉出第一梯队,是高校改革之痛?