Method: 1. Use the "sudo cat my.cnf" command to view the "my.cnf" file; 2. Use the "vim mysqld.cnf" command to edit the file content and add "default-time_zone = '8:00'" statement; 3. Restart mysql to make the new time take effect.
The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.
How to modify mysql time
View my.cnf file
Command:
cd /etc/mysql/ sudo cat my.cnf
Enter the mysql.conf.d folder
Command:
cd /etc/mysql/mysql.conf.d/
Edit the mysqld.cnf file
Command:
sudo vim mysqld.cnf##Add the following content in the [mysqld] area
default-time_zone = '+8:00'
##Restart mysql The new time zone takes effect
Command:
sudo /etc/init.d/mysql restart
Recommended learning:
mysql video tutorialThe above is the detailed content of How to modify mysql time. For more information, please follow other related articles on the PHP Chinese website!