Can not use datetime type in mysql workbench

Viewed 47457

I have tried to make a column using datetime type in MySQL workbench.
but, when I select datetime type it occurs an error like

Could not set new data type The given data type DATETIME contains errors and cannot be accepted. The previous value is kept instead"

How can I use this type?

5 Answers

As of 5.6.4 TIME, TIMESTAMP and DATETIME can have a fractional part. To create a field with subseconds you can specify precision in brackets: TIME(3), DATETIME(6) etc.

time(3)      = 05:05:10.000 (3 precision )
timestamp(6) = 2013-07-04 05:05:10.000000 (6 precision )
datetime(1)  = 2013-07-04 05:05:10.0 (1 precision )
datetime     = 2013-07-04 05:05:10 (0 precision )

Re-create the initial workbench connection or reset the advanced connection properties to update the server version. If the server has been upgraded and the workbench connection is not updated the workbench still thinks it is working with the old version and therefore restricts and flags the datetime(x) as an error.

You need to add a value into the parenthesis. For example, use DATETIME(4) instead of DATETIME().

This may happen when you want to give column data type as varchar() with no parameter.

Please write the amount inside the data type like varchar(50).

Related