Why can't I add a column with tinytext?

时间:2017-05-16 09:26:54

标签: mysql

I am trying to add a column to an existing table in mysql.

I am trying to do this:

ALTER TABLE users ADD online TINYTEXT(3) AFTER name;

But it causes this error:

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 '(3) AFTER name' at line 1

2 个答案:

答案 0 :(得分:1)

ALTER TABLE `users` ADD `online` TINYTEXT AFTER `name`;

答案 1 :(得分:1)

删除(3)。 Tinytext既不需要也不支持。如果您只想要3个字符,请不要使用tinytext,请使用char或varchar。