2019. 7. 9. 13:47ㆍIT-개발/DB
기본 설정 상태보기
MariaDB [(none)]> show variables like 'c%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
| collation_connection | utf8_general_ci |
| collation_database | latin1_swedish_ci |
| collation_server | latin1_swedish_ci |
| completion_type | NO_CHAIN |
| concurrent_insert | AUTO |
| connect_timeout | 10 |
+--------------------------+----------------------------+
14 rows in set (0.01 sec)
디폴트 캐릭터셋을 latin1에서 utf-8으로 변경하기 위해, 아래 3개의 파일에 캐릭터셋 설정을 추가한다.
• vi /etc/my.cnf.d/client.cnf
[client]
default-character-set=utf8
• vi /etc/my.cnf.d/mysql-clients.cnf
[mysql]
default-character-set=utf8
[mysqldump]
default-character-set=utf8
• vi /etc/my.cnf.d/server.cnf
[mysqld]
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8
(DB 재실행)
@ systemctl restart mariadb
(이미 생성한 database가 있다면 삭제 / 생성 및 data 추가)
MariaDB [(none)]> show variables like 'c%';
+--------------------------+----------------------------+
| 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 | /usr/share/mysql/charsets/ |
| collation_connection | utf8_general_ci |
| collation_database | utf8_unicode_ci |
| collation_server | utf8_unicode_ci |
| completion_type | NO_CHAIN |
| concurrent_insert | AUTO |
| connect_timeout | 10 |
+--------------------------+----------------------------+
14 rows in set (0.00 sec)
이렇게 나올거 같다.
'IT-개발 > DB' 카테고리의 다른 글
(SQL) TCL(Transaction Control Language) 이란 ? (0) | 2020.01.31 |
---|---|
[mysql] MySQL 하지 말아야 할 것 17가지 (펌) (0) | 2020.01.15 |
[mariadb] 유용한 명령어 모음 (펌 + 혼합) (0) | 2019.05.08 |
[mariaDB] UNION 연산자 (펌) (0) | 2019.05.08 |
[MariaDB] 기초정보 (1) (0) | 2019.04.12 |