添加或修改my.ini 配置文件,设置编码字符为utf8 ,默认为latin1,见红色字体
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
#设置3306端口
port = 3306
# 设置mysql的安装目录
basedir=D:\mysql
# 设置mysql数据库的数据的存放目录
datadir=D:\mysql\data
# 允许最大连接数
max_connections=200
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
#log-error=D:\mysql\mysql_log_err.txt
#log=D:\mysql\mysql_log.txt
#log-bin=d:/log/mysql/mysql_log_bin
#log-slow-queries= D:\mysql\mysql_log_slow.txt
SHOW VARIABLES LIKE "char%"; 查询都为utf8 后,问题解决
mysql> SHOW VARIABLES LIKE "char%";
+--------------------------+--------------------------+
| Variable_name | Value |
+--------------------------+--------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | D:\mysql\share\charsets\ |
+--------------------------+--------------------------+
8 rows in set (0.00 sec)
mysql>