首页 > 解决方案 > 无法在 MySQL 5.5.60 中设置数据类型 datetime(3)

问题描述

我正在尝试将字段从 DATATIME 转换为 DATETIME(3)。服务器版本为 5.5.60-MariaDB。我正在尝试使用工作台 8.0 来做到这一点。我收到“未检测到更改”消息,并且数据类型仍然是 DATETIME。

我尝试了以下代码来更改日期类型:

ALTER TABLE `ALLOCATED_HISTORY`
MODIFY COLUMN `DATE_EFFECTIVE` DATETIME(3) DEFAULT NULL;

当我尝试在工作台的 alter table 中查看表时,我收到 Error Prasing DLL 错误。

标签: mysql

解决方案


Mysql 5.5 can't store microseconds, this feature was introduced in 5.6.4.

as of MySQL 5.6.4, any fractional part in a value inserted into a DATETIME or TIMESTAMP column is stored rather than discarded.

https://dev.mysql.com/doc/refman/5.6/en/datetime.html


推荐阅读