In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "what is the method of mysql to modify the time zone". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Mysql method to modify the time zone: 1, in the mysql command line mode, the implementation of the "set global time_zone = 'time zone information'" command; 2, in the "my.cnf" file, find and change the value of the "default-time_zone" entry to the desired time zone.
The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.
Method 1: modify dynamically in mysql command line mode
1. View mysql's current time and current time zone
Select curtime (); # or select now ()
Show variables like 'time_zone%'; 2 rows in set (0.00 sec)
# time_zone indicates that mysql uses the time zone of system, while system_time_zone indicates that system uses CST time zone
2. Modify the time zone
Set global time_zone ='+ 8 set time_zone 00 hours; # # modify the global time zone of mysql to Beijing time, that is, our East 8 Zone flush privileges; ='+ 8 set time_zone 00 hours; # # modify the current session time zone effective immediately
Method 2: modify the time zone by modifying the my.cnf configuration file
Default-time_zone ='+ 8VR 00'
The modification is complete and restart the database server.
Method 3: with the help of PHP's mysql_connect () function (temporarily solve the time zone problem)
Mysql_query ("SET time_zone ='+ 8 00'")
This changes the time zone without rebooting. However, some system functions of mysql still cannot be used, such as: now (). This sentence is still incomprehensible.
This is the end of the content of "what is the method for mysql to modify the time zone". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.