MySQLutf8mb4 Character Set: supports emoji

Source: Internet
Author: User
Tags check character
MySQLutf8mb4 Character Set: supports emoji

MySQL utf8mb4 Character Set: supports emoji

Homepage → Database Technology

Background:

Read News

MySQL utf8mb4 Character Set: supports emoji

[Date: 2013-05-16] Source: Linux community Author: Robbin [Font:]

(I) Preface

In order to cope with opportunities and challenges of the wireless Internet, and to avoid problems caused by emoji,

We recommend that you use the utf8mb4 character set in advance for MySQL databases involving wireless connection.

This must be a key point of technology selection in the mobile Internet industry.

(Ii) Restrictions

Required> = MySQL 5.5.3 and slave database must also be 5.5. Earlier versions do not support this character set or duplicate error.

(Iii) Brief steps

The following is a configuration step that has not been upgraded to 5.5.3:

① Back up the database

② Upgrade MySQL Server to v5.5.3 +

③ Modify the character set of database, table, and column

For each database: alter database database_name character set = utf8mb4 COLLATE = COLLATE; # For each table: alter table table_name convert to character set utf8mb4 COLLATE utf8mb4_unicode_ci; # For each column: alter table table_name CHANGE column_name VARCHAR (191) character set utf8mb4 COLLATE utf8mb4_unicode_ci; # (Don't blindly copy-paste this! The exact statement depends on the column type, maximum length, and other properties. The above line is just an example for a 'varchar 'column .)

④ Modify my. cnf

[Client]
Default-character-set = utf8mb4

[Mysql]
Default-character-set = utf8mb4

[Mysqld]
Character-set-client-handshake = FALSE
Character-set-server = utf8mb4
Collation-server = utf8mb4_unicode_ci
Init_connect = 'set NAMES utf8mb4'

⑤ Restart MySQL Server and check Character Set

Mysql> show variables where Variable_name LIKE 'character \ _ set \ _ % 'OR Variable_name LIKE 'colation % ';
+ -------------------------- + -------------------- +
| Variable_name | Value |
+ -------------------------- + -------------------- +
| Character_set_client | utf8mb4 |
| Character_set_connection | utf8mb4 |
| Character_set_database | utf8mb4 |
| Character_set_filesystem | binary |
| Character_set_results | utf8mb4 |
| Character_set_server | utf8mb4 |
| Character_set_system | utf8 |
| Collation_connection | utf8mb4_unicode_ci |
| Collation_database | utf8mb4_unicode_ci |
| Collation_server | utf8mb4_unicode_ci |
+ -------------------------- + -------------------- +
Rows in set (0.00 sec)

  • 0
  • Oracle Tutorial: Learn about v $ segment_statistics

    Use the C language to configure the MySQL database Codeblocks Development Environment

    MySQL utf8mb4

    Image Information

    View All comments in this article (0)

    Comments

    Latest Information

    Popular this week

    Introduction to Linux community-advertisement service-website map-help Info-contact us
    The articles published on this site (LinuxIDC) do not mean that they agree with the statement or description. They only provide more information and do not constitute any suggestions.


    Copyright©2006-2011 Linux community All rights reserved Zhejiang ICP backup No. 06018118

    ,

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.