侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

mysql 5.7修改字符集

2023-12-20 星期三 / 0 评论 / 0 点赞 / 125 阅读 / 2108 字

For the recent version of MySQL, default-character-set = utf8 causes a problem. It's deprecated I th

For the recent version of MySQL,

default-character-set = utf8

causes a problem. It's deprecated I think.

As Justin Ball says in "Upgrade to MySQL 5.5.12 and now MySQL won’t start, you should:

  1. Remove that directive and you should be good.

  2. Then your configuration file ('/etc/my.cnf' for example) should look like that:

    [mysqld]collation-server = utf8_unicode_ciinit-connect='SET NAMES utf8'character-set-server = utf8
  3. Restart MySQL.

  4. For making sure, your MySQL is UTF-8, run the following queries in your MySQL prompt:

    • First query:

       mysql> show variables like 'char%';

      The output should look like:

       +--------------------------+---------------------------------+ | Variable_name            | Value                           | +--------------------------+---------------------------------+ | character_set_client     | utf8                            | | character_set_connection | utf8                            | | character_set_database   | utf8                            | | character_set_filesystem | binary                          | | character_set_results    | utf8                            | | character_set_server     | utf8                            | | character_set_system     | utf8                            | | character_sets_dir       | /usr/local/mysql/share/charsets/| +--------------------------+---------------------------------+
    • Second query:

       mysql> show variables like 'collation%';

      And the query output is:

       +----------------------+-----------------+ | Variable_name        | Value           | +----------------------+-----------------+ | collation_connection | utf8_general_ci | | collation_database   | utf8_unicode_ci | | collation_server     | utf8_unicode_ci | +----------------------+-----------------+

广告 广告

评论区