mysql 에서 데이터베이스 현재 케릭터셋을 확인하는 쿼리
1 2 3 4 5 6 7 8 9 10 11 |
MariaDB [mysql]> SELECT schema_name , default_character_set_name FROM information_schema.schemata ; +--------------------+----------------------------+ | schema_name | default_character_set_name | +--------------------+----------------------------+ | information_schema | utf8 | | mysql | utf8 | | performance_schema | utf8 | | sqlmonitor | utf8 | | test | utf8 | +--------------------+----------------------------+ 10 rows in set (0.00 sec) |
데이터베이스의 케릭터셋을 변경하고자 한다면 쿼리문으로 여기서는 test 데이터베이스명 utf8 -> euckr 변경
1 2 3 4 5 6 7 8 9 10 11 |
MariaDB [mysql]> alter database test default character set euckr; MariaDB [mysql]> SELECT schema_name , default_character_set_name FROM information_schema.schemata ; +--------------------+----------------------------+ | schema_name | default_character_set_name | +--------------------+----------------------------+ | mysql | utf8 | | performance_schema | utf8 | | sqlmonitor | utf8 | | test | euckr | +--------------------+----------------------------+ |
데이터베이스를 생성시에 케릭터셋을 지정해서 생성
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
MariaDB [mysql]> create database xinet_utf8 default character set utf8 collate utf8_general_ci; Query OK, 1 row affected (0.00 sec) MariaDB [mysql]> create database xinet_euckr default character set euckr collate euckr_korean_ci; Query OK, 1 row affected (0.00 sec) MariaDB [mysql]> SELECT schema_name , default_character_set_name FROM information_schema.schemata ; +--------------------+----------------------------+ | schema_name | default_character_set_name | +--------------------+----------------------------+ | xinet_euckr | euckr | | xinet_utf8 | utf8 | +--------------------+----------------------------+ 12 rows in set (0.00 sec) |