How to make MySQL handle UTF-8 properly

前端 未结 14 2789
被撕碎了的回忆
被撕碎了的回忆 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:14

    To change the character set encoding to UTF-8 for the database itself, type the following command at the mysql> prompt. USE ALTER DATABASE.. Replace DBNAME with the database name:

    ALTER DATABASE DBNAME CHARACTER SET utf8 COLLATE utf8_general_ci;
    

    This is a duplicate of this question How to convert an entire MySQL database characterset and collation to UTF-8?

提交回复
热议问题