MySQL 5.5 upgrades the character set from utf8 to utf8mb4

Source: Internet
Author: User

MySQL 5.5 upgrades the character set from utf8 to utf8mb4
Reason for upgrade

MySQL supports only three-byte UTF-8 characters by default, and does not support Emoji emoticons (four bytes). If there are four-byte characters, an error is returned. MySQL 5.5 and later versions provide utf8mb4, which supports four-byte characters.
Many iphone users add Emoji when entering nicknames. If MySQL does not use the utf8mb4 character set, such nickname information cannot be written.

1. Before upgrade.
Mysql> show variables like 'character _ set % ';
+ Bytes + | Variable_name | Value | + bytes + | character_set_client | utf8 | character_set_connection | utf8 | character_set_database | utf8 | bytes | binary | utf8 | | character_set_server | utf8 | character_set_system | utf8 | character_sets_dir |/home/sdkserver/local/mysql-5.5.43-linux2.6-x86_64/share/charsets/| + rows + 8 rows in set (0.00 sec)
Mysql> show variables like 'collation % ';
+ Rows + --------------- + | Variable_name | Value | + rows + --------------- + | collation_connection | rows | collation_database | rows | collation_server | rows | + rows + 3 rows in set (0.00 sec)
2. modify the configuration file.

Open the MySQL configuration file and modify the character set configuration as follows:

[Client] default-character-set = utf8mb4 [mysql] default-character-set = utf8mb4 [mysqld] character-set-client-handshake = FALSEcharacter-set-server = utf8mb4collation-server = Login = 'set NAMES utf8mb4'
3. After the upgrade.
Mysql> show variables like 'character _ set % ';
+ Bytes + | Variable_name | Value | + bytes + | bytes | utf8mb4 | character_set_connection | utf8mb4 | character_set_database | utf8mb4 | bytes | binary | bytes | utf8mb4 | | character_set_server | utf8mb4 | character_set_system | utf8 | character_sets_dir |/home/nieyong/local/mysql-5.5.43/share/charsets/| + rows + 8 rows in set (0.00 sec)
Mysql> show variables like 'collation % ';
+ Rows + ------------------ + | Variable_name | Value | + rows + -------------------- + | collation_connection | rows | collation_database | rows | collation_server | rows | + rows + 3 rows in set (0.00 sec)

This article permanently updates the link address:

Related Article

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.