mysql 无法精确到毫秒问题

create table PL_TEST_A
(
    A_key VARCHAR(100) not null,
	A_filed_1 VARCHAR(100) not null,
	A_filed_2 VARCHAR(100) not null,
	LMT_A TIMESTAMP(3) not null,
	primary key (A_key)
)

上述语句无法执行,时间戳不能指定毫秒,看了下 mysql 版本是 5.5.6.

于是查看了相关资料,发现是需要 5.6.4 or later 才行。

You need to be at MySQL version 5.6.4 or later to declare columns with fractional-second time datatypes. Not sure you have the right version? Try SELECT NOW(3). If you get an error, you don't have the right version.

For example, DATETIME(3) will give you millisecond resolution in your timestamps, and TIMESTAMP(6) will give you microsecond resolution on a *nix-style timestamp.

具体参考:https://stackoverflow.com/questions/26299149/timestamp-with-a-millisecond-precision-how-to-save-them-in-mysql

你可能感兴趣的:(mysql)