• 【MySQL】Mariadb字符集


    Mariadb字符集

    如果不设置字符集,可以查看mariadb的字符集的默认设置是latin1

    如下命令,查看Mariadb的默认配置:

    [root@oradb ~]# /usr/local/mysql/bin/mysqld --verbose --help |grep character-set-server
    2019-09-23 16:10:05 0 [Note] Plugin 'FEEDBACK' is disabled.
      -C, --character-set-server=name 
    character-set-server                                       latin1
    

    修改Mariadb的字符集为utf8,国际统一标准,配置如下:

    [root@oradb ~]# vi /etc/my.cnf 
    [mysqld]
    datadir=/u01/data/
    socket=/tmp/mysql.sock
    user=mysql
    # Disabling symbolic-links is recommended to prevent assorted security risks
    symbolic-links=0
    character-set-server = utf8
    
    [mysqld_safe]
    log-error=/u01/data/mysqld.log
    pid-file=/tmp/mysqld.pid
    

    重启服务,如下:

    [root@oradb ~]# service mysqld restart
    

    最终,服务器统一为utf8,如下:

    [root@oradb ~]# mysql -uroot -p
    Enter password: 
    Welcome to the MariaDB monitor.  Commands end with ; or g.
    Your MariaDB connection id is 9
    Server version: 10.3.18-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    
    MariaDB [(none)]> show variables like '%character%';
    +--------------------------+----------------------------------+
    | 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/ |
    +--------------------------+----------------------------------+
    8 rows in set (0.001 sec)
    
  • 相关阅读:
    Adobe产品在Lion上的已知问题
    SAP HANA能否推动实时应用?
    如果Android与Chrome合体?
    基于MINA构建简单高性能的NIO应用MINA架构
    Drupal 测试邮件发送
    jQuery doTimeout插件: 比setTimeout实用
    Raven – 社会化浏览器
    LSO/Flash Cookie
    CSS3动画效果animate.css
    seaJs的模块定义、模块加载及模块依赖关系
  • 原文地址:https://www.cnblogs.com/zhangshengdong/p/11724990.html
Copyright © 2020-2023  润新知