How to make MySQL handle UTF-8 properly

前端 未结 14 2563
被撕碎了的回忆
被撕碎了的回忆 2020-11-22 06:38

One of the responses to a question I asked yesterday suggested that I should make sure my database can handle UTF-8 characters correctly. How I can do this with MySQL?

14条回答
  •  心在旅途
    2020-11-22 07:31

    To make this 'permanent', in my.cnf:

    [client]
    default-character-set=utf8
    [mysqld]
    character-set-server = utf8
    

    To check, go to the client and show some variables:

    SHOW VARIABLES LIKE 'character_set%';
    

    Verify that they're all utf8, except ..._filesystem, which should be binary and ..._dir, that points somewhere in the MySQL installation.

提交回复
热议问题