初始代码
This commit is contained in:
15
yawei-mes/数据库时区问题.md
Normal file
15
yawei-mes/数据库时区问题.md
Normal file
@@ -0,0 +1,15 @@
|
||||
> 如果业务sql使用数据库的sysdate()函数,而生成的时间与当前国内时间对不上
|
||||
> ,比如操作日志的操作日期,可能是时区不对。
|
||||
|
||||
```sql
|
||||
-- 查看当前数据库时区设置
|
||||
SELECT @@global.time_zone, @@session.time_zone;
|
||||
|
||||
-- 设置全局时区为中国时区
|
||||
SET GLOBAL time_zone = '+8:00';
|
||||
|
||||
-- 设置会话时区为中国时区
|
||||
SET time_zone = '+8:00';
|
||||
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user