解决Mysql错误提示Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE)

       今天在写数据库作业的时候,针对这个问题,我一直在找解决办法,现在终于是被我解决了。
在网上看了很多办法,把这些办法串起来就是最终办法了,可以不用重新安装。

第一步:查看mysql根目录的my.ini是否修改成功
         将 default-character-set=latin1 修改成 default-character-set=utf8
              character-set-server=utf8    修改成  character-set-server=utf8

              (修改保存后,需要重启mysql)
字符不同的话,需要修改成相同字符
set collation_connection = utf8_ general_ci(或utf8_unicode_ci)

第二步:输入sql命令,查看mysql字符集设置
        mysql> show variables like "%char%";
+--------------------------+---------------------------------------------------------+
| Variable_name            | Value                                                   |
+--------------------------+---------------------------------------------------------+
| character_set_client     | utf8                                                    |
| character_set_connection | utf8                                                    |
| character_set_database   | utf8                                                    |
| character_set_filesystem | binary                                                  |
| character_set_results    | utf8                                                    |
| character_set_server     | utf8                                                    |
| character_set_system     | utf8                                                    |
| character_sets_dir       | C:\Program Files\MySQL\MySQL Server 5.5\share\charsets\ |
+--------------------------+---------------------------------------------------------+
如果不是utf8格式,则需要修改成utf8。

sql命令:set character_set_client = utf8;
               再查看具体字符,输入sql命令:show variables like "%coll%";
+----------------------+-----------------+
| Variable_name        | Value           |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database   | utf8_general_ci |
| collation_server     | utf8_general_ci |
+----------------------+-----------------+
              字符不同的话,需要修改成相同字符
              set collation_connection = utf8_ general_ci(或utf8_unicode_ci)

你可能感兴趣的:(mysql)