今天使用Ubuntu在终端下执行Mysql,本来想通过goods_brands数据表来更新goods数据表,但是执行命令时报了Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_general_mysql500_ci,IMPLICIT) for operation '='的错误。
问题描述
goods表
image.png
granbs_brnads表
image.png
执行
update goods as g inner join goods_brands as b on g.brand_name=b.name set g.brand_name=b.id;
提示如下错误。
Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_general_mysql500_ci,IMPLICIT) for operation '='
错误如下图所示:
image.png
解决办法:
执行该命令即可:ALTER TABLE goods_brands CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;命令截图如下图所示:
image.png
然后执行
update goods as g inner join goods_brands as b on g.brand_name=b.name set g.brand_name=b.id;命令实现,通过goods_brands数据表来更新goods数据表
image.png










网友评论