zoukankan      html  css  js  c++  java
  • mysql更改已经存在的数据库的默认编码

    Caused by: java.sql.SQLException: Illegal mix of collations (gb2312_chinese_ci,IMPLICIT) and (gbk_chinese_ci,IMPLICIT) for operation '<'
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
        at com.mysql.jdbc.Connection.execSQL(Connection.java:3256)
        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1313)
        at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:874)
        at com.mysql.jdbc.CallableStatement.execute(CallableStatement.java:752)

    项目报错 Cause: java.sql.SQLException: Illegal mix of collations (gb2312_chinese_ci,IMPLICIT) and (gbk_chinese_ci,IMPLICIT) for operation '<'

    经过分析得知原来是字符编码的问题,原来是gbk的后来用的gb2312所以要更改数据库的编码

    方法如下

    1、右键数据库 选择数据库数据库属性

    2、点击下拉框选择要更改的字符集

    3、使用 下面的方法不顶用

    set character_set_database=gbk;  --这个方法不顶用  上面的方法顶用
  • 相关阅读:
    shell入门-cut命令
    shell入门-特殊符号
    shell入门-系统和用户的配置文件
    shell入门-变量
    shell入门-shell特性
    linux命令-yum工具详解
    linux命令-rpm查询包
    linux命令-rpm安装和卸载
    math 数学模块
    random 随机模块
  • 原文地址:https://www.cnblogs.com/huanglei2010/p/10138112.html
Copyright © 2011-2022 走看看