查看数据库字符集 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 | | character_sets_dir | /usr/local/mysql/share/charsets/ | +--------------------------+----------------------------------+
修改Mysql字符集为UTF-8的方法:在/etc/my.cnf对应如下配置段加入相应命令。 [client]字段里加入default-character-set=utf8 [mysqld]字段里加入character-set-server=utf8 [mysql]字段里加入default-character-set=utf8 然后重启MySQL服务即可。