Today I found that a program inserted an incorrect time, and the field was configured with the default value CURRENT_TIMESTAMP. I initially determined that it was a problem with the database time zone setting. Check time zone Log in to the database to view the time zone configuration: mysql> show variables like '%time_zone%'; +------------------+--------+ | Variable_name | Value | +------------------+--------+ | system_time_zone | EDT | | time_zone | SYSTEM | +------------------+--------+ 2 rows in set (0.00 sec)
Change time zone To change the time zone: # Only change the time zone of the current session and stop the session from being invalidated set time_zone = '+8:00'; # Modify the global time zone configuration set global time_zone = '+8:00'; flush privileges; Of course, you can also modify the configuration file (my.cnf) to achieve the configuration, but you need to restart the service. # vim /etc/my.cnf ##Add default-time_zone = '+8:00' in the [mysqld] area # /etc/init.d/mysqld restart ##Restart mysql to make the new time zone take effect By the way, unlike China, the United States has 4 time zones... Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. You may also be interested in:
|
>>: Mini Programs use Mini Program Cloud to implement WeChat payment functions
This article describes how to enable https servic...
Click here to return to the 123WORDPRESS.COM HTML ...
Use text-align, margin: 0 auto to center in CSS W...
In Docker's design, a container runs only one...
Reference: MySQL character set summary utf8mb4 ha...
In daily work, we often need to view logs. For ex...
Install mysql5.7 under win, for your reference, t...
Recently, when using kazam in Ubuntu 20.04 for re...
Table of contents Million-level data processing s...
Table of contents The basic principles of Vue'...
1. Demand The local test domain name is the same ...
1. Preparation Example: Two machines: 192.168.219...
This article uses examples to illustrate the prin...
Mine is: <!DOCTYPE html> Blog Garden: <!...
background: Sometimes we need to display json dat...