AWS RDS Parameter Group not changing MySQL encoding

匿名 (未验证) 提交于 2019-12-03 01:36:02

问题:

I am running a MySQL database on RDS. I want to change all of my encodings to utf8mb4. I created a parameter group on RDS with all character_set_* parameters as utf8mb4, assigned it to my RDS instance, and then rebooted the instance. However, when I run SHOW VARIABLES LIKE '%char%' on my DB, there are still values of latin1, which I do not want:

character_set_client        latin1 character_set_connection    latin1 character_set_database      utf8mb4 character_set_filesystem    binary character_set_results       latin1 character_set_server        utf8mb4 character_set_system        utf8 character_sets_dir          /rdsdbbin/mysql-5.6.22.R1/share/charsets/ 

Likewise, new columns that I create on the DB are latin1 encoded instead of utf8mb4 encoded. I can change the encoding values manually through the mysql command line, but this doesn't help since the values are also reset to latin1 when I push to production.

回答1:

I think this the issue is the distinction between VARIABLES and GLOBAL VARIABLES.

If you list the GLOBAL VARIABLES this should reflect what you see in your parameter group: (assuming you've rebooted as Naveen suggested)

SHOW GLOBAL VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%'; 

This is opposed to what you see in your regular VARIABLES:

SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%'; 

These can sometimes be overridden by the options supplied in the connection. eg connecting using the options --default-character-set:

mysql -h YOUR_RDS.us-east-1.rds.amazonaws.com -P 3306 --default-character-set=utf8 -u YOUR_USERNAME -p  


回答2:

After changing the parameter group - do you the warning "Pending Reboot" in the console. If yes, try rebooting the DB Instance and the new character set would start be applied.

More information - http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithParamGroups.html



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!