简体   繁体   中英

AWS RDS MySQL with Unicode

我在AWS RDS上运行MySQL,有人知道如何将那里的字符集设置为UTF-8吗?

You can modify the database parameters through the AWS GUI/CLI or you can just create your tables with the required character set. (The Table character set does not need to match your database character set, nor match your column's character set)

Eg

CREATE TABLE t1
(
    c1 CHAR(10) CHARACTER SET utf8mb4
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Here I've used utf8mb4 , which supports the full Unicode set, including Emojis, which MySQL's utf8 does not.

I actually wanted to change the settings for the whole database. There's no way to do it after the DB is created, however, during the DB creation via AWS RDS console, it's just a matter of selecting the right Parameter Group. If you only have the default Parameter Group, just go to Parameter Groups section to create your specific one setting the right "character set" and then use that group.

So, this basically solves my problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM