mysql乱码问题 配置mysql utf-8编码

在编译安装mysql 时可能会忘记配置mysql 编码为utf-8,下面的例子mysql版本为mysql-5.5.29

修改my.cnf

[mysqld]
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8


然后重启进入mysql 客户端命令行查看
mysql> show variables like “%character%”;
show variables like “%collation%”;

+————————–+———————————————————————+
| 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 | /Users/yseasony/develop/mysql-5.5.29-osx10.6-x86_64/share/charsets/ |
+————————–+———————————————————————+

  1. 暂无评论

  1. 暂无 Trackback

return top