zoukankan      html  css  js  c++  java
  • MySQL 字符集设置

    /***************************************************************************
     *                         MySQL 字符集设置
     * 说明:
     *     数据库这块很多时候都会因为字符集不兼容导致数据通信异常,所以这边把
     * MySQL的字符集设定为utf-8,这个比较通用。
     *
     *                                         2016-9-24 深圳 南山平山村 曾剑锋
     **************************************************************************/
    
    一、参考文档:
        1. (原创)Linux下MySQL 5.5/5.6的修改字符集编码为UTF8(彻底解决中文乱码问题)
            http://www.ha97.com/5359.html
    
    二、解决办法:
        cat /etc/my.cnf
            ......
            [client]
            ......
            default-character-set=utf8
            ......
            [mysql]
            ......
            default-character-set=utf8
            ......
            [mysqld]
            ......
            collation-server = utf8_unicode_ci
            init-connect='SET NAMES utf8'
            character-set-server = utf8
            ......
    
    三、查看结果:
        [aplex@root ~]# mysql -u root -p
        Enter password: 
        Welcome to the MySQL monitor.  Commands end with ; or g.
        Your MySQL connection id is 1
        Server version: 5.1.73-log Source distribution
        
        Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
        
        Oracle is a registered trademark of Oracle Corporation and/or its
        affiliates. Other names may be trademarks of their respective
        owners.
        
        Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
        
        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/ |
        +--------------------------+----------------------------+
        8 rows in set (0.00 sec)
        
        mysql> quit
        Bye
        [aplex@root ~]# 
  • 相关阅读:
    C语言 两个跟结构(struct)有关的参数传递问题
    Linux虚拟机 Ubuntu执行sudo apt-get install出现无法解析域名
    损失函数
    决策树(分类树、回归树)
    k近邻(k-NN)算法
    机器学习和深度学习的区别
    无量纲量和有量纲量
    常用激活函数/损失函数/代价函数
    深度学习:激活函数、损失函数、优化函数的区别
    逻辑回归--推导明确,但理论较少
  • 原文地址:https://www.cnblogs.com/zengjfgit/p/5902542.html
Copyright © 2011-2022 走看看