Configure Amazon RDS mysql to store Chinese Characters, amazonrds

Source: Internet
Author: User
Tags mysql command line

Configure Amazon RDS mysql to store Chinese Characters, amazonrds

 

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 to configure the Amazon RDS to store Chinese Characters in the right way? Currently the text all becomes '???? '.

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

mysql> show variables like '%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/ |+--------------------------+-------------------------------------------++----------------------+-----------------+| Variable_name        | Value           |+----------------------+-----------------+| collation_connection | utf8_general_ci || collation_database   | utf8_general_ci || collation_server     | utf8_unicode_ci |+----------------------+-----------------+
Mysql amazon-rds
Using improve this question Edited Jul 27 at 22: 46Kara3, 12373147 Asked Jun 6'13 at 3: 24 Yujun Wu1, 19752442
  Add a comment
3 Answersactiveoldestvotes
Up vote9down voteaccepted

After following @ Peter Venderberghe's answer to configure RDS, I still can not 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 besidesPASSWORD.PASSWORDShocould be the one you created for the instance.HOSTNAMEORIPIs "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 you are comfortable with, you need to give it some commands:

# set character set and collation for databasemysql> alter database DATABASENAME CHARACTER SET utf8 COLLATE utf8_unicode_ci;--------# set character set and collation for new records in a tablemysql> ALTER TABLE TABLENAME CHARACTER SET utf8 COLLATE utf8_unicode_ci;# set character set and collation for existing records in a tablemysql> ALTER TABLE TABLENAME CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;

You may want to write a script to do this task if you have tables. However, it's not in the scope of this answer.

After loading ing as abve, you should be able to rock with Chinese characters!

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.