mysql modify time zone

The server rented by a friend is from abroad. After obtaining the database saved by the current time through CURRENT_TIMESTAMP, it always feels strange. Finally, I found out that it was a time zone problem. The solution I found on the Internet is as follows, the test is effective, and I also make a record by the way.

 

1. View mysql current time, current time zone

select tanning();

 

2. Modify the time zone

set global time_zone = '+8:00'; ##Modify the mysql global time zone to Beijing time, which is the East 8th district where we are located

set time_zone = '+8:00'; ##Modify the current session time zone

flush privileges; #effective immediately

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324739566&siteId=291194637