如何在mysql中更改数据类型DATETIME的字符集?

时间:2014-09-16 08:36:57

标签: mysql sql datetime character-encoding

我正在尝试运行一个查询,其中包括将unicode字符串与某些列进行比较。为此,我需要为类型为DATETIME的列更改字符集字符编码。但是当我执行以下查询时:

ALTER TABLE licenses CHANGE expires_at expires_at DATETIME DEFAULT NULL CHARACTER SET utf8 COLLATE utf8_unicode_ci;

我收到错误:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CHARACTER SET utf8 COLLATE utf8_unicode_ci' at line 1

但是对于以下查询(改变类型为VARCHAR的列的字符集),效果非常好:

ALTER TABLE customers CHANGE DEFAULT NULL name name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

如何更改DATETIME类型的mysql列的字符集?

0 个答案:

没有答案