错误如下: illegal mix of collations (gbk_chinese_ci,implicit) and (gbk_bin,implicit) for operation '=', sql state: hy000, error code: 1267 错误原因: 数据库的编码与建表时的编码不一样; 处理方法: 如果安装mysql时设置的编码为jbk,那么在
错误如下:
illegal mix of collations (gbk_chinese_ci,implicit)
and (gbk_bin,implicit) for operation '=',
sql state: hy000, error code: 1267
错误原因:
数据库的编码与建表时的编码不一样;
处理方法:
如果安装mysql时设置的编码为jbk,那么在建表时可以如下处理:
create table `teachers` (
`id` int(11) not null default '0',
`name` varchar(20) default null,
`password` varchar(20) default null,
`department_id` int(11) default null,,
primary key (`id`)
) engine=myisam default charset=gbk;
或者:
create table `teachers` (
`id` int(11) not null default '0',
`name` varchar(20) default null,
`password` varchar(20) default null,
`department_id` int(11) default null,
primary key (`id`)
) ;