AWS RDS参数组未更改MySQL编码 [英] AWS RDS Parameter Group not changing MySQL encoding

查看:252
本文介绍了AWS RDS参数组未更改MySQL编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在RDS上运行MySQL数据库.我想将所有编码更改为utf8mb4.我在RDS上创建了一个参数组,其中所有character_set_*参数都为utf8mb4,并将其分配给我的RDS实例,然后重新启动该实例.但是,当我在数据库上运行SHOW VARIABLES LIKE '%char%'时,仍然有latin1的值,我不希望这样做:

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/

同样,我在数据库上创建的新列是latin1编码的,而不是utf8mb4编码的.我可以通过mysql命令行手动更改编码值,但这无济于事,因为当我投入生产时,这些值也会重置为latin1.

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.

推荐答案

我认为这是变量 GLOBAL VARIABLES 之间的区别.

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

如果您列出 GLOBAL VARIABLES (全球变量),则应该反映出您在参数组中看到的内容:(假设您已按照Naveen的建议重新启动)

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 

这篇关于AWS RDS参数组未更改MySQL编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆