如何防止mariadb在重启时重置时区?

时间:2019-05-11 09:03:32

标签: timezone mariadb

每次重新启动mariadb时,都会重置时区:

MariaDB [(none)]> SELECT @@global.time_zone;      
+--------------------+
| @@global.time_zone |
+--------------------+
| Europe/Amsterdam   |
+--------------------+
1 row in set (0.000 sec)

MariaDB [(none)]> \q;

时区是欧洲/阿姆斯特丹。但是当我重新启动它时,它以某种方式变为SYSTEM。

me@dbhost:~/ $ sudo systemctl restart mysqld;
me@dbhost:~/ $ mysql -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 10.3.14-MariaDB-log Source distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> SELECT @@global.time_zone;
+--------------------+
| @@global.time_zone |
+--------------------+
| SYSTEM             |
+--------------------+
1 row in set (0.000 sec)

这是为什么,如何预防呢?

1 个答案:

答案 0 :(得分:1)

请参见Time Zones

[mariadb]
...
default_time_zone = 'Europe/Amsterdam';