Get the App
SLTechnology News&Howtos  ›  Database  › 

How does mysql view and modify the time zone?

Shulou Source: shulou.com Published: 2022-06-01 19:00:22 10月03日 Update

Method 1

#View time zone show variables like "%time_zone%";set global time_zone = '+8: 00'; ##Modify mysql global time zone to Beijing time, i.e. our East 8 zone set time_zone = '+8: 00'; ##Modify current session time zone flush privileges; #Effective immediately

Method 2

linux

# vim /etc/my.cnf ##Add default-time_zone = '+8: 00'# /etc/init.d/mysqld restart ##Restart mysql to make the new time zone take effect

windows

Modify the configuration file my.ini

Path C:\ProgramData\MySQL\MySQL Server 5.7

ProgramData is a hidden folder

Add under [mysqld]

#Set default time zone default-time-zone='+08: 00'

Restart mysql in cmd as administrator

net stop mysqlnet start mysql

If it's wrong,

Invalid service name. Type HELNET PMSG 2185 for more help.

Error in service name Please check service name in Services

windows+r, open run, enter services.msc, find mysql services,

View service name mysql57,

net stop mysql57net start mysql57

The above is mysql view and modify the time zone method details, more please pay attention to other related articles!

Tags: Time zone service method file more global content region that is location folder article time result administrator path identity error Beijing China plus Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Redmi Apple Docker MariaDB