Press "Enter" to skip to content

mysql/mariadb设置默认编码

主机环境如下:
[root@test ~]# uname -a
Linux test 3.10.0-693.el7.x86_64 #1 SMP Thu Jul 6 19:56:57 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@test ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.4 (Maipo)
[root@test ~]# mysql -V
mysql Ver 15.1 Distrib 5.5.56-MariaDB, for Linux (x86_64) using readline 5.1

1.通过 show variables like '%char%';查看mariadb字符集情况

2.修改mariadb配置文件
#备份配置文件
cp /etc/my.cnf /etc/my.cnf_bak
vi /etc/my.cnf
[client]
default-character-set=utf8
[mysqld]
default-storage-engine=INNODB
character-set-server=utf8
collation-server=utf8_general_ci

3.重启mariadb
systemctl restart mariadb

4.查看字符集

Be First to Comment

发表评论

电子邮件地址不会被公开。 必填项已用*标注