Configure Amazon RDS MySQL to store Chinese characters

Source: Internet
Author: User
Tags mysql command line

Configure Amazon RDS MySQL to store Chinese characters

Https://dev.mysql.com/doc/refman/5.7/en/charset-applications.html

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html# Cfn-rds-dbinstance-charactersetname

Http://stackoverflow.com/questions/16953232/configure-amazon-rds-mysql-to-store-chinese-characters

Up vote5down votefavorite1

How do I configure the Amazon RDS to store Chinese characters? Currently the text all becomes '???? '.

I already created new parameter group and set character set as UTF8 and modify the instance. Below is the detail info:

Mysql>Show variablesLike '%char% ';+--------------------------+-------------------------------------------+|Variable_name|Value|+--------------------------+-------------------------------------------+|Character_set_client|Utf8||Character_set_connection|Utf8||Character_set_database|Utf8||Character_set_filesystem|Binary||Character_set_results|Utf8||Character_set_server|Utf8||Character_set_system|Utf8||Character_sets_dir| /Rdsdbbin/Mysql-5.5.27.R1/Share/Charsets/ |+--------------------------+-------------------------------------------++----------------------+-----------------+|| Value | +----------------------+-----------------+ |  collation_connection | Utf8_general_ci |< Span class= "PLN" >| Collation_database || |  Collation_server | Utf8_unicode_ci |+----------------------+-----------------+    
MySQL Amazon-rds
ShareImprove this question Edited Jul at 22:46Kara3,1237 Asked June 6 ' at 3:24yujun Wu1,1975
Add a Comment
3 answersactiveoldestvotes
Up vote9down voteaccepted

After following @Peter Venderberghe's answer to configure RDS, I still can don't let it store Chinese characters correctly.

Finally, I used MySQL command line-to-connect to RDS (you can use MySQL Workbench or other client tool you like)

Mysql-u username-ppassword-h Hostnameorip DATABASENAME

Note

1). Remember to add your current IP to security group inbound of RDS before connecting to RDS

2). You can get related information (security groups, USERNAME ... etc) on RDS console besides. Should is the one PASSWORD PASSWORD yo U created for the instance. is HOSTNAMEORIP ' Endpoint ' (without the port) on the console.

3). There is no space between-p and PASSWORD. It ' s exactly -pPASSWORD .

After connecting to MySQL with the tool is comfortable with, you need to give it some commands:

# SetCharacterSet andCollationFor DatabaseMysql> Alter DatabaseDATABASENAME CHARACTERSETUtf8COLLATEUtf8_unicode_ci;--------# SetCharacterSet andCollationForNew recordsInchATableMysql> Alter TABLETABLENAME CHARACTERSETUtf8collate Utf8_unicode_ci;# set character set< Span class= "PLN" > and collation forin a tablemysql> alter table  TABLENAME convert toset UTF8 collate Utf8_unicode_ci                 

You could want to the write a script to does this task if you have many tables. However, it's not under the scope of this answer.

After configuring as above, you should is able to rock with Chinese characters!

Configure Amazon RDS MySQL to store Chinese characters

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.