MySQL中文显示乱码问题

1、查看MySQL数据库字符集


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 | 本文来自 dedecms.com
| character_sets_dir | C:\mysql\share\charsets\ |
-------------------------- --------------------------
8 rows in set (0.08 sec)

2、默认为utf8格式,如果导入的数据库中文显示乱码,修改mysql的配置文件my.ini,非安装版的在 [client],[mysqld],[mysql]分别添加default-character-set=gbk或gb2312,保存后重启mysql服务就可以了

相关推荐