Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS RDS Parameter Group not changing MySQL encoding

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.

like image 462
ill_always_be_a_warriors Avatar asked Aug 31 '25 18:08

ill_always_be_a_warriors


2 Answers

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 in the other answer)

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 
like image 108
Dean Avatar answered Sep 02 '25 07:09

Dean


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

enter image description here

like image 33
Naveen Vijay Avatar answered Sep 02 '25 08:09

Naveen Vijay