Home > Database > Mysql Tutorial > How to modify the default time zone of mysql

How to modify the default time zone of mysql

王林
Release: 2020-07-11 17:47:38
forward
3534 people have browsed it

How to modify the default time zone of mysql

1. View MySQL current time zone and time

(Recommended tutorial: mysql tutorial)

show variables like "%time_zone%";  #查看时区
Copy after login

How to modify the default time zone of mysql

#time_zone indicates that mysql uses the system's time zone, system_time_zone indicates that the system uses the CST time zone

select curtime();  #查看时间
select now();  #查看日期+时间
Copy after login

2. Modify the time zone

You can modify the time zone by modifying the my.cnf configuration file

# vim /etc/my.cnf
Copy after login

Add the following content in the [mysqld] area:

default-time_zone = '+8:00'
Copy after login

After the modification is completed, you need to restart MySQL for the configuration to take effect.

The above is the detailed content of How to modify the default time zone of mysql. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template