MySQL Modify character Set

Source: Internet
Author: User

Modify the database character set from UTF8 to UTF8MB4

Modifying the default character set for a library
alter database test default character set utf8mb4 COLLATE utf8mb4_unicode_ci;
Modify the default character set for a table
ALTER TABLE test DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
Convert the original data in the table to UTF8MB4
ALTER TABLE test CONVERT TO CHARACTER SET utf8mb4;

#修改列字符集

ALTER TABLE test CHANGE column_name VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
modifying character Set parameters

[Client]
Default-character-set = Utf8mb4

[Mysqld]
Character-set-server = Utf8mb4
Collation-server = Utf8mb4_unicode_ci
init_connect= ' SET NAMES utf8mb4 '

[Client]
Default-character-set = UTF8
[MySQL]
Default-character-set = UTF8
[Mysqld]
Character-set-server = UTF8
init-connect= ' Set names UTF8 ' works on character_set_client, Character_set_connection, Character_set_results

Character_set_system is the coded character set used when the system metadata (field name, and so on) is stored, regardless of the data stored in the field. Always fix the constant--utf8. We can not take care of it.
Character_set_server settings for the server level (Mysqld level) Character set
There are also server-level collations set up together: Collation_server
Character_set_database

MySQL Modify character Set

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.