1. 개요
mysql charset 설정 및 확인 방법
2. charset 확인
방법 1> mysql -u root -p
status;
show variables like ‘char%’;
방법 2> mysqladmin variables | grep char
3. charset 변경
3.1 MYSQL [5.1]
vi /etc/my.cnf
[mysqld] character-set-server = utf8 init_connect="SET collation_connection = utf8" init_connect="SET NAMES utf8" [client] default-character-set = utf8 [mysql] default-character-set = utf8 [mysqldump] default-character-set = utf8
service mysqld restart
3.2 MYSQL [5.5]
vi /etc/my.cnf
[mysqld] character_set_server = utf8
service mysqld restart
3.3 MariaDB [15.1]
vi /etc/my.cnf.d/mysql-clients.cnf
[mysqld] init_connect="SET collation_connection = utf8_general_ci" init_connect="SET NAMES utf8" character-set-server = utf8 collation-server = utf8_general_ci [mysql] default-character-set = utf8 [mysqldump] default-character-set = utf8 [client] default-character-set = utf8
systemctl restart mysql