언제나 그렇게 서버를 날려먹고...

이참에 리눅스로 다시 가자 해서 CentOS 설치했습니다

APM을 https://xetown.com/tips/1123973 이걸로 설치 하였고

 

phpmyadmin 에서 DB생성을 하려고 보니

latin1_swedish_ci 으로 기본으로 잡혀있는데

이걸 utf8_general_ci 이나 utf8mb4_general_ci로 기본 설정을 못할까요?

  • profile

    my.cnf에서

        character-set-server = utf8mb4

        collation-server = utf8mb4_unicode_ci

    로 설정을 변경한 후 DB를 재시작하세요.

     

    MySQL에서 말하는 utf8은 반쪽짜리 유니코드이고 utf8mb4가 진짜인 것처럼, _general_ci는 반쪽짜리 정렬 옵션입니다. 유니코드를 제대로 활용하려면 _unicode_ci를 사용해야 합니다. 얘네들은 꼭 처음에 일을 제대로 안 해서 두 번째 옵션을 선택하게 만드는 버릇이 있어요.

     

    단, 기본값을 변경한다고 이미 생성된 DB나 테이블의 문자셋이 변경되지는 않습니다. 라이믹스를 설치하셨다면 utf8mb4_unicode_ci로 생성되었을 가능성이 높습니다.

  • profile profile
    vi /etc/my.cnf를 해보니

    #
    # This group is read both both by the client and the server
    # use it for options that affect everything
    #
    [client-server]

    #
    # include all files from the config directory
    #
    !includedir /etc/my.cnf.d

    이렇게만 있는데 어디다가 추가를 하면 될까요?
  • profile profile
    /etc/my.cnf.d 폴더에 있는 파일들을 인클루드하고 있네요. 그 폴더 안에서 가장 내용이 많은 설정파일을 찾아보세요. 이름에 server가 들어 있을 가능성이 높습니다.
  • profile
    #
    # 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]

     

    이렇게 되어있어요 

  • profile profile
    [mysqld] 또는 [mariadb] 아래에 추가해 보세요.
  • profile profile
    답변 감사합니다.
    server.cnf에서 [mysqld]에 넣으니 잘 작동 합니다