zoukankan      html  css  js  c++  java
  • centos 5.5 mysql5.5 乱码

    1. 找到mysql的配置文件,拷贝到etc目录下,第一步很重要

    使用find命令查找cnf文件。记得不要去找my.cnf因为它不一定存在,而应该找*.cnf。
    [root@linuxserver classes] find / -iname *.cnf -print
    /root/Desktop/mysql-5.0.56/mysql-test/std_data/ndb_config_mycnf1.cnf
    /root/Desktop/mysql-5.0.56/mysql-test/std_data/bug15328.cnf
    /root/Desktop/mysql-5.0.56/mysql-test/std_data/ndb_config_mycnf2.cnf
    /etc/my.cnf
    /etc/pki/tls/openssl.cnf
    /usr/share/mysql/my-medium.cnf
    /usr/share/mysql/my-large.cnf
    /usr/share/mysql/my-small.cnf
    /usr/share/mysql/my-huge.cnf
    /usr/share/mysql/my-innodb-heavy-4G.cnf
    /usr/share/doc/MySQL-server-community-5.0.92/my-medium.cnf
    /usr/share/doc/MySQL-server-community-5.0.92/my-large.cnf
    /usr/share/doc/MySQL-server-community-5.0.92/my-small.cnf
    /usr/share/doc/MySQL-server-community-5.0.92/my-huge.cnf
    /usr/share/doc/MySQL-server-community-5.0.92/my-innodb-heavy-4G.cnf

    找到之后,复制一个出来
     cp /usr/share/doc/MySQL-server-community-5.0.92/
    my-large.cnf   /etc/my.cnf

     

    2. 打开my.cnf修改编码

     vi /etc/my.cnf

    [mysqld]下添加                                          是mysqld,而不是mysql下!
    character_set_server=utf8



    重启mysql

     service mysqld restert

    4.登录mysql看看修改成功否

    show variables like 'character%';
    +--------------------------+----------------------------+
    | 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       | /usr/share/mysql/charsets/ |


  • 相关阅读:
    SQLAlchemy使用说明之ORM
    Python日志模块logging
    Python正则表达式模块re
    group by 小结
    Hive Beeline 官方文档学习
    在MySQL中创建cm-hive使用的数据库及账号
    MySQL导入数据错误error: 13 及解决办法
    Yum 安装并设置 MySQL
    使用xshell5 从CentOS主机download资料
    Bootstrap 学习
  • 原文地址:https://www.cnblogs.com/xiaowangba/p/6314446.html
Copyright © 2011-2022 走看看