修改配置文件my.ini
将其改为:(路径根据自己mysql的安装路径进行适当调整,与字符编码无关,不必改动)
[mysqld] basedir=C:\MYSQL57 datadir=C:\MYSQL57\data character_set_server=utf8 collation-server=utf8_general_ci [client] default-character-set=utf8
重新启动mysql服务
执行SHOW VARIABLES LIKE 'character%';即可看到:
mysql> SHOW VARIABLES LIKE 'character%'; +--------------------------+----------------------------+ | 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 | C:\MYSQL57\share\charsets\ | +--------------------------+----------------------------+ 8 rows in set, 1 warning (0.00 sec) |