MySQL配置编码为UTF-8

Linux修改/etc/my.cnf,WIndows修改安装目录的my.ini【my-default.ini拷贝一份命名my.ini】对于Linux修改重要文件前可以先备份一下

[client]
default-character-set=utf8

[mysqld]
#default-storage-engine=INNODB
character-set-server=utf8
collation-server=utf8_general_ci

datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

default-character-set=utf8

 重启Mysql,登录Mysql查看编码

show variables like 'char%';

看到如下则说明修改成功 

 MySQL配置编码为UTF-8_第1张图片

********************************* 不积跬步无以至千里,不积小流无以成江海 *********************************

你可能感兴趣的:(MySQL)