mysql字符集修改(ubuntu)

1.关闭mysql服务

/etc/init.d/mysql start|stop

2.在/etc/mysql/my.cnf,添加下列信息

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

3.修改表的字符集

alter table tableName convert to character set utf8 collate utf8_general_ci;

4.修改字段字符集

alter table tableName change columnName columnName columnType character set utf8 collate utf8_general_ci; 

5.查看各项编码

show variables like '%character%';
show full columns from tableName;
posted @ 2017-06-17 17:04  不被女生喜欢好多年  阅读(546)  评论(0编辑  收藏  举报