Mysql method to view and modify time zone

藏色散人
Release: 2020-04-25 13:58:25
forward
2939 people have browsed it

Mysql method to view and modify time zone

Method 1

#查看时区 show variables like "%time_zone%"; set global time_zone = '+8:00'; ##修改mysql全局时区为北京时间,即我们所在的东8区 set time_zone = '+8:00'; ##修改当前会话时区 flush privileges; #立即生效
Copy after login

Method 2

## linux

# vim /etc/my.cnf ##在[mysqld]区域中加上 default-time_zone = '+8:00' # /etc/init.d/mysqld restart ##重启mysql使新时区生效
Copy after login

windowsModify the configuration file my.ini

Path

C:\ProgramData\MySQL\MySQL Server 5.7

ProgramData is a hidden folder

Add under [mysqld]

#设置默认时区 default-time-zone='+08:00'
Copy after login

Restart mysql in cmd as administrator

net stop mysql net start mysql
Copy after login

If an error is reported

服务名无效。 请键入 NET HELPMSG 2185 以获得更多的帮助。
Copy after login

is an error in the service name. Please check the service name in the service

windows r, open the run, enterservices.msc, and find the mysql service.

Check the service name mysql57,

net stop mysql57 net start mysql57
Copy after login

Mysql method to view and modify time zone

Recommended: "

mysql video tutorial"

The above is the detailed content of Mysql method to view and modify time zone. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!