加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – mysql alter table add column utf8

发布时间:2020-12-13 17:24:01 所属栏目:PHP教程 来源:网络整理
导读:有任何想法,如何添加列: alter table tname add column cname text character set utf8 collate utf8_general_ci if not exists; 这给出了一个错误: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual thatcorresponds to your
有任何想法,如何添加列:

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

这给出了一个错误:

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

我需要使用utf-8编码添加新列.

谢谢

解决方法

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

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读