MySQL数据库创建表时出现乱码解决方案
MySQL数据库创建表时出现乱码解决方案
·
操作环境:workbench MySQL5.7.3
MySQL是我们常用的数据型数据库,我们在建立表时经常用到中文字符,但又经常出现中文乱码的情况。例如:
create table if not exists student_info
(学号 char(4) not null,
姓名 char(8) not null,
性别 char(2),
出生日期 date,
家庭住址 varchar(50),
primary key(学号));
#此时查看建立的表会出现中文乱码
解决以上问题只需要在建立表最后加上charset=utf8mb4即可;
create table if not exists student_info
(学号 char(4) not null,
姓名 char(8) not null,
性别 char(2),
出生日期 date,
家庭住址 varchar(50),
primary key(学号))charset=utf8mb4;
#此时就能正确建立中文字符的表
问题解决。
更多推荐
已为社区贡献1条内容
所有评论(0)