MySQL Support emoji solution

Source: Internet
Author: User

MySQL does not show emoji expression or display?? , the reason is not explained here, directly to say the solution. (mainly modified UTF8MB4)

1. Modify the table

2. Modifying fields

ALTER TABLE ' table_name ' MODIFY COLUMN ' column_name '  varchar CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

3. CharSet when modifying client connections

Example: In thinkphp, when you configure a link database parameter, ' db_charset ' = ' utf8mb4 '

Do here, basically already can show emoji expression. If not, then below.

4. Modifying the database environment

SHOW VARIABLES WHERE variable_name like ' character\_set\_% ' OR variable_name like ' collation% ';

+ —————————--- ----+--------------------------+| 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_general_ci     | | Collation_database           | utf8mb4_general_ci     | | Collation_server               | utf8mb4_general_ci      |+-----------------------------+ ——————---————— +  Change example:mysql>    set character_set_client=utf8mb4;  modify it to look like the table above.   If not, please recompile MySQL, but landlord did not try for a long time not to say.

MySQL support emoji workaround

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.