Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set MySQL server variable collation_connection to utf8_unicode_ci on AWS RDS

So my goal is to set all the character sets and collations to utf8 and utf8_unicode_ci.

Im using an AWS RDS to host the MySQL server.

Ive set the collation_connection variable to utf8_unicode_ci in the Parameter group for the RDS. This is how I set the variable in the parameter group .

Ive then rebooted my RDS and when going to MySQL console it shows the following values for variables.

mysql> show variables like "%character%";show variables like "%collation%";
+--------------------------+-------------------------------------------+
| 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.6.22.R1/share/charsets/ |
+--------------------------+-------------------------------------------+
8 rows in set (0.01 sec)

+----------------------+-----------------+
| Variable_name        | Value           |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database   | utf8_unicode_ci |
| collation_server     | utf8_unicode_ci |
+----------------------+-----------------+

Im not sure why the collation_connection is set as utf8_general_ci

like image 879
Parampal Pooni Avatar asked Mar 11 '16 03:03

Parampal Pooni


People also ask

How do I connect to an RDS database in MySQL?

Sign in to the AWS Management Console and open the Amazon RDS console at https://console.aws.amazon.com/rds/ . In the navigation pane, choose Databases to display a list of your DB instances. Choose the name of the MySQL DB instance to display its details. On the Connectivity & security tab, copy the endpoint.

How do I enable query logging in RDS?

Open the Amazon RDS console, and then choose Databases from navigation pane. Choose your DB instance, and then choose the Logs view. In the Logs & Events tab, choose the most recent log, and then choose View log to see the content of logs.

How do I get a slow query log in RDS?

Activate MySQL slow query log At first, go to AWS RDS dashboard, and go to “Parameter Groups”. You can set the “slow_query_log” to “1” and save it. Set “long_query_time” as you want. The queries slower than this value will be recorded to the slow query log.

Does AWS RDS support MySQL?

Amazon RDS supports MySQL Community Edition versions 5.7 and 8.0 which means that the code, applications, and tools you already use today can be used with Amazon RDS.


1 Answers

The variables which you see here are the current client session's variables:

+----------------------+-----------------+
| Variable_name        | Value           |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database   | utf8_unicode_ci |
| collation_server     | utf8_unicode_ci |
+----------------------+-----------------+

So, you need to run the following commands, when you initiate the connection, on the client from which you are connecting:

SET collation_connection = 'utf8_unicode_ci';
like image 71
Iqbal S Avatar answered Sep 17 '22 05:09

Iqbal S