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.
.
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
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.
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.
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.
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.
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';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With