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