找到xampp中my.ini,添加
[client]
default_character_set=utf8
[mysqld]
character-set-server = utf8
collation-server = utf8_general_ci
[mysql]
default_character_set=utf8