• 修改编码为utf8mb4 以支持emoji表情


    环境:

    项目db的所有字符集都已经初始化为utf-8,如 status命令显示如下:

    Server characterset: utf8
    Db characterset: utf8
    Client characterset: utf8
    Conn. characterset: utf8

    一、修改对应项目数据库级别字符集:

    mysql> show create database yyf;
    +----------+--------------------------------------------------------------+
    | Database | Create Database |
    +----------+--------------------------------------------------------------+
    | yyf | CREATE DATABASE `yyf` /*!40100 DEFAULT CHARACTER SET utf8 */ |
    +----------+--------------------------------------------------------------+
    1 row in set (0.00 sec)

    mysql> alter database yyf CHARACTER SET utf8mb4;
    Query OK, 1 row affected (0.00 sec)

    mysql> show create database yyf;
    +----------+-----------------------------------------------------------------+
    | Database | Create Database |
    +----------+-----------------------------------------------------------------+
    | yyf | CREATE DATABASE `yyf` /*!40100 DEFAULT CHARACTER SET utf8mb4 */ |
    +----------+-----------------------------------------------------------------+
    1 row in set (0.00 sec)

    二、修改表级别的字符集:

     alter table t1 CHARSET=utf8mb4;

    三、修改客户端连接数据库的配置:

     return [
    'class' => 'yiidbConnection',
    'driverName' => 'mysql',
    'dsn' => 'mysql:host=xxxx;port=3306;dbname=yyf;',
    'username' => 'xxxx',
    'password' => 'xxxx',
    ###'charset' => 'utf8',
    'charset' => 'utf8mb4',
    ];
  • 相关阅读:
    POJ3320 Jessica's Reading Problem
    POJ3320 Jessica's Reading Problem
    CodeForces 813B The Golden Age
    CodeForces 813B The Golden Age
    An impassioned circulation of affection CodeForces
    An impassioned circulation of affection CodeForces
    Codeforces Round #444 (Div. 2) B. Cubes for Masha
    2013=7=21 进制转换
    2013=7=15
    2013=7=14
  • 原文地址:https://www.cnblogs.com/yiyuf/p/4956699.html
Copyright © 2020-2023  润新知