当前位置:网站首页>Three methods of modifying time zone in MySQL
Three methods of modifying time zone in MySQL
2022-06-30 18:07:00 【forever_ up422】
Summary record modification mysql Three ways to time zone .
Method 1 : adopt mysql Dynamic modification in command line mode
1.1 see mysql current time , Current time zone
> select curtime(); # or select now() It's fine too
+-----------+
| curtime() |
+-----------+
| 15:18:10 |
+-----------+
> show variables like "%time_zone%";
+------------------+--------+
| Variable_name | Value |
+------------------+--------+
| system_time_zone | CST |
| time_zone | SYSTEM |
+------------------+--------+
1.2 Change the time zone
> set global time_zone = '+8:00'; ## modify mysql The global time zone is Beijing time , That is where we are 8 District
> set time_zone = '+8:00'; ## Modify the current session time zone
> flush privileges; # Immediate effect
Method 2 : By modifying the my.cnf Configuration file to modify the time zone
# vim /etc/my.cnf ## stay [mysqld] Add... To the area
default-time_zone = '+8:00'
# /etc/init.d/mysqld restart ## restart mysql Make the new time zone effective
Method 3 : If it is not convenient to restart mysql, I want to solve the time zone problem temporarily , Can pass php Or other languages are initializing mysql Initializes mysql The time zone
here , With php For example , stay mysql_connect() Next use :
mysql_query("SET time_zone = '+8:00'")
边栏推荐
- . Net ORM framework hisql practice - Chapter 1 - integrating hisql
- Canvas cloud shape animation
- K-line diagram interpretation and practical application skills (see position entry)
- Booking UI effect implemented by svg
- 基于eNSP的校园网设计的仿真模拟
- Animesr: learnable degradation operator and new real world animation VSR dataset
- Login box tricks
- Do fresh students get a job or choose a job after graduation?
- Combination of applet container and Internet of things
- Conception d'un centre commercial en ligne basé sur SSH
猜你喜欢

How to write a technical proposal

What did Tongji and Ali study in the CVPR 2022 best student thesis award? This is an interpretation of yizuo

基于SSM的新闻管理系统

【架构】1366- 如何画出一张优秀的架构图
![[Netease Yunxin] playback demo build: unable to convert parameter 1 from](/img/6e/41e1eafd4c863c9e5f3a545b69a257.png)
[Netease Yunxin] playback demo build: unable to convert parameter 1 from "asyncmodalrunner *" to "std:: nullptr\u T"**

Fragmentary knowledge points of MySQL

巴比特 | 元宇宙每日必读:未成年人打赏后要求退款,虚拟主播称自己是大冤种,怎么看待这个监管漏洞?...

构建基本buildroot文件系统

Six photos vous montrent pourquoi TCP serre la main trois fois?

Booking UI effect implemented by svg
随机推荐
Development details of NFT casting trading platform
基於SSH的網上商城設計
Plane intersection and plane equation
Deep understanding of JVM (V) - garbage collection (II)
Compile and generate busybox file system
【义修换届大礼包】
Rainbow Brackets 插件的快捷键
What should I pay attention to when playing futures? Where is safe to open an account? It's my first contact
[sword finger offer] 52 The first common node of two linked lists
大文件处理(上传,下载)思考
Login box tricks
Word中添加代码块(转载)
零基础也能做Apple大片!这款免费工具帮你渲染、做特效、丝滑展示
Generate confrontation network, from dcgan to stylegan, pixel2pixel, face generation and image translation.
Babbitt | yuanuniverse daily must read: minors ask for a refund after a reward. The virtual anchor says he is a big wrongdoer. How do you think of this regulatory loophole
Six photos vous montrent pourquoi TCP serre la main trois fois?
【剑指Offer】53 - I. 在排序数组中查找数字 I
巴比特 | 元宇宙每日必读:未成年人打赏后要求退款,虚拟主播称自己是大冤种,怎么看待这个监管漏洞?...
Small tools (3) integration knife4j3.0.3 interface document
构建基本buildroot文件系统