ror 中的mysql乱码

show table status where Collation like "la%";

发现大家都是latin1不是utf8的

傻乎乎的全改了ALTER TABLE table_nameCONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;


网上说 /etc/my.cnf 修改一下

[client]
default-character-set=utf8
[mysqld_safe]
default-character-set=utf8
[mysqld]
default-character-set=utf8
[mysql]
default-character-set=utf8

也可

show variables like '%char%';查看一下还有东西是latin1

改之:

set character_set_client=utf8;
set character_set_connection=utf8;

set character_set_database=utf8;
啥不好改啥。。。。。

show variables like 'collation_%' 大家都是utf8了,应该清净了

你可能感兴趣的:(mysql乱码)