如何更改mysql编码

来源:互联网 发布:jenkins php 编辑:程序博客网 时间:2024/05/15 04:57

1.

在创建数据表时将默认编码改为gb2312
如:mysql> create table student(id int(3) auto_increment not null primary key, sed char(8),sex char(2),csny date) DEFAULT CHARSET=gb2312;
这样在mysql里就可以显示中文了

2.
打MySQL安装目录,找到my.ini这个文件,用记事本打开
default-character-set=gb2312

这个字段就是设置编码的,后面的是编码格式.