• <table id="x5mq0"><track id="x5mq0"></track></table>
  • <code id="x5mq0"><nobr id="x5mq0"><sub id="x5mq0"></sub></nobr></code>

      <pre id="x5mq0"><small id="x5mq0"><p id="x5mq0"></p></small></pre>
    1. <pre id="x5mq0"><small id="x5mq0"><track id="x5mq0"></track></small></pre>

    2. <th id="x5mq0"><video id="x5mq0"></video></th>

      Mariadb中文字符集問題處理

      默認情況下Mariadb的中文無法正常顯示,需要設置默認字符集才能正常顯示中文。

      注: 修改的實際目的就是,Client和Server端的字符集保持一致

      1.全局設置方法

      1. 編輯配置文件,增加默認參數 vi /etc/mysql/my.cnf
      2. 重啟 systemctl restart mariadb

      my.cnf 中增加下面一段 UTF8編碼的默認配置。

      [mysqld]
      init_connect='SET collation_connection = utf8_unicode_ci'
      init_connect='SET NAMES utf8'
      character-set-server=utf8
      collation-server=utf8_unicode_ci
      skip-character-set-client-handshake
      
      [mysql]
      default-character-set=utf8
      

      重啟MariaDB即可

      systemctl restart mariadb
      

      查看字符集方法: show variables like "%character%"

      MariaDB [(none)]> show variables like "%character%";
      +--------------------------+----------------------------+
      | Variable_name            | Value                      |
      +--------------------------+----------------------------+
      | character_set_client     | utf8mb4                    |
      | character_set_connection | utf8mb4                    |
      | character_set_database   | utf8mb4                    |
      | character_set_filesystem | binary                     |
      | character_set_results    | utf8mb4                    |
      | character_set_server     | utf8mb4                    |
      | character_set_system     | utf8                       |
      | character_sets_dir       | /usr/share/mysql/charsets/ |
      +--------------------------+----------------------------+
      8 rows in set (0.002 sec)
      

      2. 其他問題

      如果上述方法還是有問題,需要看一下系統默認使用的字符集。

      3. 安裝

      查看數據庫服務狀態

      sudo apt install mariadb-server
      systemctl status mariadb
      

      顯示結果

      test@testsvr:~/libs$ systemctl status mariadb
      ● mariadb.service - MariaDB 10.3.27 database server
         Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
         Active: active (running) since Sun 2021-06-13 11:19:45 HKT; 59s ago
           Docs: man:mysqld(8)
                 https://mariadb.com/kb/en/library/systemd/
       Main PID: 20463 (mysqld)
         Status: "Taking your SQL requests now..."
          Tasks: 31 (limit: 1149)
         Memory: 76.5M
         CGroup: /system.slice/mariadb.service
                 └─20463 /usr/sbin/mysql
       ....
      

      END(Moguf)

      亚洲成A∨人片在线观看无码
    3. <table id="x5mq0"><track id="x5mq0"></track></table>
    4. <code id="x5mq0"><nobr id="x5mq0"><sub id="x5mq0"></sub></nobr></code>

        <pre id="x5mq0"><small id="x5mq0"><p id="x5mq0"></p></small></pre>
      1. <pre id="x5mq0"><small id="x5mq0"><track id="x5mq0"></track></small></pre>

      2. <th id="x5mq0"><video id="x5mq0"></video></th>