赞
踩
一、查找my.conf的位置
[root@dcm-no zookeeper]# whereis my.cnf
my: /etc/my.cnf
[root@dcm-no zookeeper]#
二、在[mysql]和[mysqld]标签下分别增加(修改)以下内容
vim /etc/my.cnf
[mysql]
default-character-set = utf8
[mysqld]
character_set_server = utf8
三、重启数据库
[root@dcm-no zookeeper]# service mysql restart
Redirecting to /bin/systemctl restart mysql.service
[root@dcm-no zookeeper]#
四、验证编码是否改变
进入数据库查询:show variables like ‘%char%’;
查询结果:
character_set_database和character_set_server的值都为utf8
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。