Configure Amazon RDS mysql to store Chinese Characters

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 votefavorite

1

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


shareimprove this question

edited Jul 27 at 22:46

Kara

3,12373147

asked Jun 6 ‘13 at 3:24

Yujun Wu

1,19752442

 
add a comment

3 Answers

activeoldestvotes


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 besides PASSWORDPASSWORD should be the one you created for the instance. HOSTNAMEORIP is "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 database
mysql> alter database DATABASENAME CHARACTER SET utf8 COLLATE utf8_unicode_ci;
--------
# set character set and collation for new records in a table
mysql> ALTER TABLE TABLENAME CHARACTER SET utf8 COLLATE utf8_unicode_ci;
# set character set and collation for existing records in a table
mysql> 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 many tables. However, it‘s not in the scope of this answer.

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

时间: 2024-10-26 10:40:57

Configure Amazon RDS mysql to store Chinese Characters的相关文章

Amazon RDS MySQL数据库还原时 log_bin_trust_function_creators 错误解决办法

使用了Amazon AWS EC2免费云空间,数据库实例采用Amazon RDS.原来在Windows Server上有一个存在大量数据的MySQL数据库.现在需要在Amazon RDS上还原这个MySQL数据库,勾掉Views(因为它会要求SUPER权限,而Master User无此权限,毕竟是托管的RDS),只留下Tables,如下图(使用Navicat): 图1:勾掉Views,因为RDS上的Masteruser无Super权限,无法还原Views对象 但在还原时,仍然出现如下的错误信息:

96.7% recognition rate for handwritten Chinese characters using AI that mimics the human brain

96.7% recognition rate for handwritten Chinese characters using AI that mimics the human brain Fujitsu today announced the development of the world's first handwriting recognition technology by utilizing AI technology modeled on human brain processes

Amazon RDS的通用型存储(SSD)

在今年的6月份,我们曾介绍过为Amazon EC2实例提供的基于SSD的弹性块级存储.在发布几个月过后,这种被称为通用型存储(SSD)的新型选择方式在创建新的EBS卷中已经占到了90%,我们从客户的反馈中得知他们非常喜欢这种一致的性能表现 (预配置存储每GB为3 IOPS),并且在用户需要的时候提升到3000 IOPS,而不需要考虑预置存储的容量限制. 现在,我们为Amazon RDS也提供了同样的表现恒定并且具有能力提升的能力,作为一个RDS的用户,您将有三种不同类型的存储可供选择: 1) 

RDS MySQL 全文检索相关问题的处理

RDS MySQL 全文检索相关问题 1. RDS MySQL 对全文检索的支持 2. RDS MySQL 全文检索相关参数 3. RDS MySQL 全文检索中文支持 3.1 MyISAM 引擎表 3.2 InnoDB 引擎表 4. like '%xxx%' 和全文检索的比较 4.1 like '%xxx%' 4.2 全文检索 5. ft_query_expansion_limit 参数作用 1. RDS MySQL 对全文检索的支持 RDS MySQL 5.5 仅 MyISAM 引擎表支持全

RDS MySQL 表上 Metadata lock 的产生和处理

1. Metadata lock wait 出现的场景 2. Metadata lock wait 的含义 3. 导致 Metadata lock wait 等待的活动事务 4. 解决方案 5. 如何避免出现长时间 Metadata lock wait 导致表上相关查询阻塞,影响业务 1. Metadata lock wait 出现的场景 创建.删除索引 修改表结构 表维护操作(optimize table.repair table 等) 删除表 获取表上表级写锁 (lock table tab

EnCase v.s. FTK - find out Chinese characters writing in different direction

A friend of mine said to me that she could fool those forensic tools easily by changing writing direction in text. I said to her: "Really? Are you sure...don't jump to conclusions too soon...". She showed me two screenshots as below: 1.She used

RDS MySQL 连接数满情况的处理

RDS MySQL 连接数满情况的处理 RDS MySQL 连接数满有2种情况 1. 空闲连接过多 原因: 应用使用长连接模式 - 对于长连接模式(比如Java应用),应用侧应该配置连接池.连接池的初始连接数设置过高,应用启动后建立多个到RDS实例空闲连接.如果出现连接数满(too many connections)不能连接的问题,请检查连接池是否启用了复用连接功能. 应用使用短连接模式 - 对于短连接模式(比如PHP应用),出现大量的空闲连接说明应用没有在查询执行完毕后显式的关闭连接.用户应该

fedota 20编译php checking for mysql_set_server_option in -lmysqlclient... no configure: error: wrong mysql library version or lib not found. 错误

php-5.5.15 + mysql-5.5.27,编译php的时候报错,checking for mysql_set_server_option in -lmysqlclient... no configure: error: wrong mysql library version or lib not found. Check config.log for more information. 解决方法重新编译mysql,并把-DENABLE_DTRACE=0这项加进mysql的编译cmake

RDS MySQL 空间问题的原因和解决

来源:https://help.aliyun.com/knowledge_detail/41739.html RDS MySQL 空间问题的原因和解决 更新时间:2016-07-22 17:20:14 1. 原因 2. 解决 2.1 Binlog 文件 2.2 数据文件 2.3 临时文件 2.4 系统文件 RDS MySQL 实例日常使用中随着实例的使用,会出现空间使用告警甚至超过实例限额被锁定的情况. 比如: 1. 原因 Binlog 文件占用高 数据文件占用高 临时文件占用高 系统文件占用高