2018. 5. 6. 14:43ㆍ99. 정리전 - IT/13. Unix 얇팍지식
AWS Linux에서 MySQL서버 UTF-8 한글 설정
[ec2-user@ip-172-31-20-116 ~]$ sudo vi /etc/my.cnf
[mysql]
default-character-set=utf8
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd
# 0 : 대소문자를 구분함(default)
# 1 : 대소문자를 구분안함(대문자로 쓴 쿼리도 소문자로 변경해서 날린다)
# 2 : 윈도우에서도 대소문자를 구분함
lower_case_table_names=1
character-set-client-handshake=FALSE
init_connect="SET collation_connection=utf8_general_ci"
init_connect="SET NAMES utf8"
character-set-server=utf8
collation-server=utf8_general_ci
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
bind-address=0.0.0.0
[sourcecode language=”sql”]
show variables like ‘lower_case_table_names%’
[/sourcecode]
[client]
default-character-set=utf8
my.cnf 설정 후 재기동
[ec2-user@ip-172-31-20-116 ~]$ sudo service mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]
[ec2-user@ip-172-31-20-116 ~]$