In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Today, what the editor shares with you is a summary of the methods of setting the time zone and default coding of MySQL. Many people don't know much about it. Today, in order to let you know more about the method of setting the time zone and default coding of MySQL, I summarized the following for you. Let's read on. I'm sure you'll get something.
Situation description
When learning spring boot, install MySQL5.7 locally in Windows, configure the project, prompt you to set the time zone after startup, and find garbled codes in the process of use, which cannot be displayed in Chinese. The main reason for the above problems is that the time zone and code are not set in MySQL5.7.
Solution
1. Set the data source url of MySQL in the configuration file application.properties of spring boot
Spring.datasource.url=jdbc:mysql://localhost:3306/yunzhi_spring_boot?characterEncoding=utf-8&serverTimezone=GMT%2B8
Explanation:
CharacterEncoding is used to set the database code, using utf-8
ServerTimezone is the time zone set. "GMT%2B8" means GMT+8. Beijing time in East eighth Zone.
If you are interested, you can learn the difference between GMT and UTC.
2. If you feel troublesome to set this every time, modify the configuration file my.ini of MySQL directly and set two parameters:
Default-time-zone=+08:00character-set-server=utf8
Then save and restart the MySQL service.
The MySQL url in the project can be simplified to:
Spring.datasource.url=jdbc:mysql://localhost:3306/yunzhi_spring_boot
The above is a brief introduction to the method of setting the time zone and default coding of MySQL. Of course, the differences in the detailed use of the above still have to be understood by everyone. If you want to know more, welcome to follow the industry information channel!
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.