How do I change a MySQL table to UTF-8?

前端 未结 5 514
野趣味
野趣味 2020-12-15 03:57

I know there are many settings for a language for a table and a database.

I already created the database. I believe when I created it, it was default/LATIN. I want

5条回答
  •  暖寄归人
    2020-12-15 04:40

    Add to your my.cnf this:

    [mysqld]
    character-set-server=utf8
    default-collation=utf8_unicode_ci
    

    And restart mysqld deamon.

    ADDED:

    ALTER DATABASE your_base_name CHARACTER SET utf8 COLLATE utf8_unicode_ci;
    

    and my.cnf

    SET collation_connection     = utf8_unicode_ci;
    SET character_set_results    = utf8;
    SET character_set_connection = utf8;
    SET character_set_client     = utf8;
    

提交回复
热议问题