Discuz! info: MySQL Query Error
User: ts1
Time: 2006-2-17 10:49pm
Script: /plugin.php
SQL: select * from cdb_qiuhun where dlg='0' and (username='ts1' or tousername='ts1')
Error: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (gbk_chinese_ci,COERCIBLE) for operation '='
Errno.: 1267
Similar error report has beed dispatched to administrator before.
造成上述错误的原因是由于mysql配置的字符集为latin1_swedish_ci,而DZ4数据库是采用gbk_chinese_ci字符集的.
因此在升级数据库时必须加上CHARSET=gbk参数才行.
具体代码如下:
- DROP TABLE IF EXISTS cdb_jhzhufu;
- CREATE TABLE `cdb_jhzhufu` (
- `ID` mediumint(8) unsigned NOT NULL auto_increment,
- `jhid` mediumint(8) unsigned NOT NULL default '0',
- `username` varchar(15) NOT NULL default '',
- `tousername` varchar(15) NOT NULL default '',
- `addtime` int(10) unsigned default NULL,
- `lmoney` int(10) unsigned default NULL,
- `message` text,
- KEY `ID` (`ID`)
- ) TYPE=MyISAM AUTO_INCREMENT=2 CHARSET=gbk;
- DROP TABLE IF EXISTS cdb_jie;
- CREATE TABLE `cdb_jie` (
- `ID` mediumint(8) unsigned NOT NULL auto_increment,
- `username` varchar(15) NOT NULL default '',
- `thename` varchar(15) NOT NULL default '',
- `year` int(10) unsigned default NULL,
- `longs` int(10) unsigned default NULL,
- `addtime` int(10) unsigned default NULL,
- `TYPE` tinyint(3) unsigned NOT NULL default '0',
- `content` text,
- `jiehun` tinyint(1) unsigned NOT NULL default '0',
- KEY `ID` (`ID`)
- ) TYPE=MyISAM AUTO_INCREMENT=10 CHARSET=gbk;
- DROP TABLE IF EXISTS cdb_lihun;
- CREATE TABLE `cdb_lihun` (
- `id` mediumint(8) unsigned NOT NULL auto_increment,
- `username` varchar(15) NOT NULL default '',
- `tousername` varchar(15) NOT NULL default '',
- `addtime` int(10) unsigned default NULL,
- `reason` text,
- `indict` smallint(1) NOT NULL default '0',
- PRIMARY KEY (`id`)
- ) TYPE=MyISAM AUTO_INCREMENT=5 CHARSET=gbk;
- DROP TABLE IF EXISTS cdb_qiuhun;
- CREATE TABLE `cdb_qiuhun` (
- `ID` mediumint(8) unsigned NOT NULL auto_increment,
- `username` varchar(15) NOT NULL default '',
- `tousername` varchar(15) NOT NULL default '',
- `addtime` int(10) unsigned default NULL,
- `message` text,
- `dlg` tinyint(1) unsigned NOT NULL default '0',
- `jiehun` tinyint(1) unsigned NOT NULL default '0',
- `content` text,
- KEY `ID` (`ID`)
- ) TYPE=MyISAM AUTO_INCREMENT=10 CHARSET=gbk;
复制代码
[ 本帖最后由 guofs 于 2006-2-18 19:39 编辑 ] |