MySQL Variables datetime_format 数据库 参数变量解释及正确配置使用

本站中文解释

datetime_format参数是用于控制MySQL服务器上时间和日期字段在使用者终端屏幕上、被发送出去给使用者及放在文件中时的格式,它也影响了用户在MySQL中使用不同的时间和日期函数时所得到的结果。

要设置datetime_format参数,可以通过两种方式进行:

1、在系统变量文件(my.cnf/my.ini/my.conf)中添加该参数:datetime_format='{date_format} {time_format}’

其中{date_format}及{time_format}都是由yyyy, MM, dd, HH, mm, ss 等字母组成的时间/日期的格式,如:

datetime_format=’%Y-%m-%d %H:%i:%s’

2、可以像下面这样使用SQL语句(需要有SUPAR USER权限)来设置:

SET GLOBAL datetime_format='{date_format} {time_format}’;

官方英文解释

datetime_format

This variable is unused. It is deprecated and is removed in
MySQL 8.0.


数据运维技术 » MySQL Variables datetime_format 数据库 参数变量解释及正确配置使用