언제나 그렇게 서버를 날려먹고...
이참에 리눅스로 다시 가자 해서 CentOS 설치했습니다
APM을 https://xetown.com/tips/1123973 이걸로 설치 하였고
phpmyadmin 에서 DB생성을 하려고 보니
latin1_swedish_ci 으로 기본으로 잡혀있는데
이걸 utf8_general_ci 이나 utf8mb4_general_ci로 기본 설정을 못할까요?
PHP | PHP 7.2 |
---|---|
CMS | XpressEngine |
언제나 그렇게 서버를 날려먹고...
이참에 리눅스로 다시 가자 해서 CentOS 설치했습니다
APM을 https://xetown.com/tips/1123973 이걸로 설치 하였고
phpmyadmin 에서 DB생성을 하려고 보니
latin1_swedish_ci 으로 기본으로 잡혀있는데
이걸 utf8_general_ci 이나 utf8mb4_general_ci로 기본 설정을 못할까요?
# # These groups are read by MariaDB command-line tools # Use it for options that affect only one utility # [mysql] [mysql_upgrade] [mysqladmin] [mysqlbinlog] [mysqlcheck] [mysqldump] [mysqlimport] [mysqlshow] [mysqlslap]
# # These groups are read by MariaDB server. # Use it for options that only the server (but not clients) should see # # See the examples of server my.cnf files in /usr/share/mysql/ # # this is read by the standalone daemon and embedded servers [server] # this is only for the mysqld standalone daemon [mysqld] # # * Galera-related settings # [galera] # Mandatory settings #wsrep_on=ON #wsrep_provider= #wsrep_cluster_address= #binlog_format=row #default_storage_engine=InnoDB #innodb_autoinc_lock_mode=2 # # Allow server to accept connections on all interfaces. # #bind-address=0.0.0.0 # # Optional setting #wsrep_slave_threads=1 #innodb_flush_log_at_trx_commit=0 # this is only for embedded server [embedded] # This group is only read by MariaDB servers, not by MySQL. # If you use the same .cnf file for MySQL and MariaDB, # you can put MariaDB-only options here [mariadb] # This group is only read by MariaDB-10.3 servers. # If you use the same .cnf file for MariaDB of different versions, # use this group for options that older servers don't understand [mariadb-10.3]
이렇게 되어있어요
my.cnf에서
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
로 설정을 변경한 후 DB를 재시작하세요.
MySQL에서 말하는 utf8은 반쪽짜리 유니코드이고 utf8mb4가 진짜인 것처럼, _general_ci는 반쪽짜리 정렬 옵션입니다. 유니코드를 제대로 활용하려면 _unicode_ci를 사용해야 합니다. 얘네들은 꼭 처음에 일을 제대로 안 해서 두 번째 옵션을 선택하게 만드는 버릇이 있어요.
단, 기본값을 변경한다고 이미 생성된 DB나 테이블의 문자셋이 변경되지는 않습니다. 라이믹스를 설치하셨다면 utf8mb4_unicode_ci로 생성되었을 가능성이 높습니다.