这里还是需要设置mysql.ini,用sql语句设置貌似不管用
找到my.ini
如果根目录找不到,就去找存放mysql的data的目录
C:\ProgramData\MySQL\MySQL Server 5.7 ,这里找到了my.ini -----win10系统,其他的自行查找
然后 修改
[client]
# pipe=
# socket=MYSQL
default-character-set=utf8
port=3306
[mysql]
no-beep=
default-character-set=utf8
# default-character-set=
# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this
# file.=
#
# server_type=3
[mysqld]
character-set-server=utf8
然后重启服务,再去查看字符集
show variables like '%character%' 基本就是utf8了