zoukankan      html  css  js  c++  java
  • 中文存取乱码问题

    连接要指明编码

    url=jdbc\:mysql\://localhost\:3306/ibatis?characterEncoding=utf8

    表和字段也要指明字符集

    ALTER TABLE `tbl_student` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
    ALTER TABLE `tbl_student` CHANGE `name` `name` VARCHAR( 45 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL;

    数据库安装的默认字符集

    my.ini 或者

    vi /etc/my.cnf 设置(如果没有发现这个文件,就新建1个)

    default-character-set=utf8


    set character_set_database =utf8;
    set character_set_client =utf8;
    set character_set_results =utf8;
    set character_set_server =utf8;
    set character_set_system =utf8;
    SET collation_connection = utf8_general_ci;
    SET collation_server = utf8_general_ci;
    SET collation_database = utf8_general_ci;

    mysql 查看字符相关信息
    SHOW VARIABLES LIKE 'character_set_%';
    SHOW VARIABLES LIKE 'collation_%';

    查看表内容

    show table status from `ibatis`;

    想看字段内容

    show full columns from `tbl_student`;

  • 相关阅读:
    10A:子串计算
    09I:鸡蛋的硬度
    09H:数字组合
    09G:登山
    09F:股票买卖
    09E-计算字符串距离
    09D-最大上升子序列和
    09C-全排列
    02C-垃圾炸弹
    【c#基础】vs2019设置高级选项
  • 原文地址:https://www.cnblogs.com/lanfengniao/p/3062514.html
Copyright © 2011-2022 走看看