简体   繁体   English

mysql alter table add column utf8

[英]mysql alter table add column utf8

Have anybody ideas, how to add a column: 有任何想法,如何添加列:

alter table tname add column cname text character set utf8 collate utf8_general_ci if not exists;

that gives an 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 'if not exists' at line 1

I need add new column with utf-8 encoding. 我需要使用utf-8编码添加新列。

Thanks 谢谢

这不是ALTER TABLE尝试的有效语法,

alter table tname add column cname text character set utf8 collate utf8_general_ci;

在为表格指定排序规则时,您一直小心该表格。

alter table table_name add column column_name text character set utf8 COLLATE utf8_unicode_ci DEFAULT NULL comment 'Comment to the attachment file';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM