查看數據庫字符集
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
修改Mysql字符集爲UTF-8的方法:在/etc/my.cnf對應以下配置段加入相應命令。
[client]字段里加入default-character-set=utf8
[mysqld]字段里加入character-set-server=utf8
[mysql]字段里加入default-character-set=utf8
而後重啓MySQL服務便可。sql