> 数据库 > MySQL >

MySQL乱码

MySQL乱码:

  用语句 show variables like 'character%'; 来查看当前数据库的相关编码集。

修改My.cnf文件增加

[mysqld]
character-set-server=utf8
重启Mysql:


+--------------------------+----------------------------------+
| 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 | /usr/local/mysql/share/charsets/ |
+--------------------------+----------------------------------+




(责任编辑:IT)