mysql 字符编码修改

原创
03/16 14:10
阅读数 70

    我们常用的mysql 编码都是utf8,需要修改的时候其实很简单:在/etc/my.cnf.d/ 目录下自己创建一个文件*.cnf ,编辑如下内容就可以:

[mysqld]
character-set-server = utf8mb4
character-set-client = utf8mb4
[client]
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4

重启mysql ,重看编码格式

MariaDB [cmp_microservice]> show variables like '%char%';
+--------------------------+--------------------------------------------------------+
| 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       | /opt/rh/rh-mariadb102/root/usr/share/mariadb/charsets/ |
+--------------------------+--------------------------------------------------------+

 

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部