• mysql设置字符集CHARACTER SET


    在 my.cnf 配置文件中设置相关选项,改变为相应的character set。

    设置数据库编码(sudo vi /etc/mysql/my.cnf):

    [client]
    default-character-set = utf8
    
    [mysqld]
    character-set-server = utf8
    collation-server = utf8_general_ci

    查看设置结果

    更改my.cnf之前:

    mysql> SHOW VARIABLES LIKE '%char%';
    +--------------------------+---------------------------------------------------------------+
    | Variable_name            | Value                                                         |
    +--------------------------+---------------------------------------------------------------+
    | character_set_client     | utf8                                                          |
    | character_set_connection | utf8                                                          |
    | character_set_database   | latin1                                                        |
    | character_set_filesystem | binary                                                        |
    | character_set_results    | utf8                                                          |
    | character_set_server     | latin1                                                        |
    | character_set_system     | utf8                                                          |
    | character_sets_dir       | /usr/local/mysql-5.6.21-linux-glibc2.5-x86_64/share/charsets/ |
    +--------------------------+---------------------------------------------------------------+

    设置之后,重启mysql服务($ sudo service mysql restart):

    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       | /usr/local/mysql-5.6.21-linux-glibc2.5-x86_64/share/charsets/ |
    +--------------------------+---------------------------------------------------------------+
  • 相关阅读:
    如何去除ecshop标题和网站底部的Powered by ECShop
    ecshop标签
    安装Wamp后 Apache无法启动的解决方法
    wamp5中的apache不能启动,80端口被占用
    iOS UI-AlertView(警示框)和ActionSheet(选择框、操作表单)
    iOS UI-三种简单的动画设置
    iOS UI-IOS开发中Xcode的一些使用技巧
    iOS UI-九宫格
    iOS开发-开发文档安装
    iOS UI-创建空项目
  • 原文地址:https://www.cnblogs.com/shaojiafeng/p/9791211.html
Copyright © 2020-2023  润新知