# 查看数据库字符集
mysql > show variables like 'character%';
# 先将 mysql 服务停止,然后继续后续操作
# 数据库停止
systemctl stop mysqld.service
# 查看数据库状态
systemctl status mysqld.service
# 修改数据库字符集
vi /etc/my.cnf
[client]
default-character-set = utf8
[mysql]
default-character-set = utf8
[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8
collation-server = utf8_unicode_ci
init_connect='SET NAMES utf8'
# 数据库启动
systemctl start mysqld.service
# 查看数据库字符集
mysql > show variables like 'character%';