programming study/D-MySql
20220726_mysql_charset, collation
gu9gu
2022. 7. 26. 10:31
charset
문자 집합을 뜻하며, 각 문자 집합의 크기를 어떻게 설정할 것인지 정하는 것입니다.
collation
Collation은 text data를 정렬(ORDER BY)할 때 사용합니다.
1) utf8_bin : 대 소문자를 구분, 대소문자 구분하지 않고 검색하려면 lower, upper를 사용
2) utf8_general_ci : 대 소문자를 구분하지 않음
collation 변경방법
ALTER DATABASE [database name] CHARACTER SET utf8 COLLATE utf8_bin;
ALTER TABLE [table name] CHARACTER SET utf8 COLLATE utf8_bin;
ALTER TABLE [table name] CHANGE [column name] CHARACTER SET utf8 COLLATE utf8_bin;