美文网首页
【MYSQL】Mysql Workbench: GUI客户端字符

【MYSQL】Mysql Workbench: GUI客户端字符

作者: 终极魅影 | 来源:发表于2019-01-16 12:49 被阅读0次

    简单写了两条SQL语句:

    set @uuid = 'df0d97d9-357b-47e7-914a-05c2eca39349';

    select * from table_name here uuid = @uuid;

    报出如下错误:

    Error Code: 1267. Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '='

    本意是想定义一个变量,然后在之后执行的多条SQL里面都可以使用同一个变量的值,从而不用一次改多个值:

    set @uuid='df0d97d9-357b-47e7-914a-05c2eca39349';

    delete from table_name_0 here examination_uuid=@uuid;

    delete from table_name_1 where examination_uuid=@uuid;

    update table_name_3 set state=0, status=100 where uuid=@uuid;

    执行时却遇到了本文一开始时的问题。


    解决办法:

    set collation_connection='utf8_unicode_ci';

    show variables like 'collation_%';

    再次执行,搞定

    相关文章

      网友评论

          本文标题:【MYSQL】Mysql Workbench: GUI客户端字符

          本文链接:https://www.haomeiwen.com/subject/hgxmdqtx.html