8
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AWS RDSのMysql設定がインスタンス立ち上げた状態ではUTF-8になってなく、文字化けで困った時の対処メモ

Last updated at Posted at 2012-04-26

RDSの設定は「DB Parameter Groups」と紐付いている。
そのためAWS Management Console等でParameterグループを事前に作る必要がある。

Amazon RDS Command Line ToolkitをAWSからダウンロードしてきてインストール

Amazon RDS Command Line Toolkit設定

設定(.bashrc内)

export AWS_RDS_HOME=$HOME/aws/RDSCli-1.6.001
export EC2_HOME=$HOME/aws/ec2-api-tools-1.5.2.5
export PATH=$AWS_RDS_HOME/bin:$EC2_HOME/bin:$PATH
export EC2_CERT=$HOME/aws/cert-XXX.pem
export EC2_PRIVATE_KEY=$HOME/aws/pk-XXX.pem
export EC2_URL=https://ec2.us-east-1.amazonaws.com
export EC2_REGION=us-east-1
export AWS_CREDENTIAL_FILE=$HOME/aws/AwsCredentials.properties

EC2_CERT、EC2_PRIVATE_KEY、AWS_CREDENTIAL_FILE中身はAccount Activityからダウンロード。

設定ファイルをsourceした後、以下のコマンド実行

※ここではParameter Group名を「profuction」にしてる

rds-modify-db-parameter-group production -p "name=character_set_client, value=utf8, method=immediate"
rds-modify-db-parameter-group production -p "name=character_set_connection, value=utf8, method=immediate"
rds-modify-db-parameter-group production -p "name=character_set_database, value=utf8, method=immediate"
rds-modify-db-parameter-group production -p "name=character_set_results, value=utf8, method=immediate"
rds-modify-db-parameter-group production -p "name=character_set_server, value=utf8, method=immediate"

作ったParameter GroupをインスタンスのDB Parameter Groupに設定し (DB InstancesのModify等)再起動したら適用される。
インスタンスに

8
8
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?