discuz出现表不存在错误:(1146) Table ‘discuz.forum_post‘ doesn‘t exist (可能是Mysql引擎引起的问题,或者语法兼容问题)

8 篇文章 0 订阅
3 篇文章 0 订阅

安装成功后发帖报错:
(1146) Table ‘discuz.forum_post’ doesn’t exist
SELECT * FROM forum_post WHERE authorid=‘2’ AND invisible=’-3’ AND first=‘1’ LIMIT 20
在这里插入图片描述
后来一查原来是pre_forum_post 建表失败了.报错如下:
[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘TYPE=MyISAM’ at line 36
大致意思就是语法问题不支持TYPE=MyISAM
然后我有改成ENGINE=MyISAM,还是报错,不过这次报错不一样了,错误信息如下:
[Err] 1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key
表定义不正确;只能有一个auto列,必须将其定义为键

pre_forum_post 原表结构:

CREATE TABLE pre_forum_post (
  pid int(10) unsigned NOT NULL,
  fid mediumint(8) unsigned NOT NULL DEFAULT '0',
  tid mediumint(8) unsigned NOT NULL DEFAULT '0',
  `first` tinyint(1) NOT NULL DEFAULT '0',
  author varchar(15) NOT NULL DEFAULT '',
  authorid mediumint(8) unsigned NOT NULL DEFAULT '0',
  `subject` varchar(80) NOT NULL DEFAULT '',
  dateline int(10) unsigned NOT NULL DEFAULT '0',
  message mediumtext NOT NULL,
  useip varchar(15) NOT NULL DEFAULT '',
  `port` smallint(6) unsigned NOT NULL DEFAULT '0',
  invisible tinyint(1) NOT NULL DEFAULT '0',
  anonymous tinyint(1) NOT NULL DEFAULT '0',
  usesig tinyint(1) NOT NULL DEFAULT '0',
  htmlon tinyint(1) NOT NULL DEFAULT '0',
  bbcodeoff tinyint(1) NOT NULL DEFAULT '0',
  smileyoff tinyint(1) NOT NULL DEFAULT '0',
  parseurloff tinyint(1) NOT NULL DEFAULT '0',
  attachment tinyint(1) NOT NULL DEFAULT '0',
  rate smallint(6) NOT NULL DEFAULT '0',
  ratetimes tinyint(3) unsigned NOT NULL DEFAULT '0',
  `status` int(10) NOT NULL DEFAULT '0',
  tags varchar(255) NOT NULL DEFAULT '0',
  `comment` tinyint(1) NOT NULL DEFAULT '0',
  replycredit int(10) NOT NULL DEFAULT '0',
  position int(8) unsigned NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (tid,position),
  UNIQUE KEY pid (pid),
  KEY fid (fid),
  KEY authorid (authorid,invisible),
  KEY dateline (dateline),
  KEY invisible (invisible),
  KEY displayorder (tid,invisible,dateline),
  KEY `first` (tid,`first`)
) TYPE=MyISAM;

更改后表结构:
修改点:
PRIMARY KEY (tid,position), ===》 PRIMARY KEY (position),
然后就是MySQL引擎的变化,TYPE=MyISAM; ==》 ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `pre_forum_post` (
  `pid` int(10) unsigned NOT NULL,
  `fid` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `tid` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `first` tinyint(1) NOT NULL DEFAULT '0',
  `author` varchar(15) NOT NULL DEFAULT '',
  `authorid` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `subject` varchar(80) NOT NULL DEFAULT '',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  `message` mediumtext NOT NULL,
  `useip` varchar(15) NOT NULL DEFAULT '',
  `port` smallint(6) unsigned NOT NULL DEFAULT '0',
  `invisible` tinyint(1) NOT NULL DEFAULT '0',
  `anonymous` tinyint(1) NOT NULL DEFAULT '0',
  `usesig` tinyint(1) NOT NULL DEFAULT '0',
  `htmlon` tinyint(1) NOT NULL DEFAULT '0',
  `bbcodeoff` tinyint(1) NOT NULL DEFAULT '0',
  `smileyoff` tinyint(1) NOT NULL DEFAULT '0',
  `parseurloff` tinyint(1) NOT NULL DEFAULT '0',
  `attachment` tinyint(1) NOT NULL DEFAULT '0',
  `rate` smallint(6) NOT NULL DEFAULT '0',
  `ratetimes` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `status` int(10) NOT NULL DEFAULT '0',
  `tags` varchar(255) NOT NULL DEFAULT '0',
  `comment` tinyint(1) NOT NULL DEFAULT '0',
  `replycredit` int(10) NOT NULL DEFAULT '0',
  `position` int(8) unsigned NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`position`),
  UNIQUE KEY `pid` (`pid`),
  KEY `fid` (`fid`),
  KEY `authorid` (`authorid`,`invisible`),
  KEY `dateline` (`dateline`),
  KEY `invisible` (`invisible`),
  KEY `displayorder` (`tid`,`invisible`,`dateline`),
  KEY `first` (`tid`,`first`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

pre_common_member_grouppm消息建表失败,表结构如下

CREATE TABLE pre_common_member_grouppm (
	uid MEDIUMINT (8) UNSIGNED NOT NULL DEFAULT '0',
	gpmid SMALLINT (6) UNSIGNED NOT NULL AUTO_INCREMENT,
	`status` TINYINT (1) NOT NULL DEFAULT '0',
	dateline INT (10) UNSIGNED NOT NULL DEFAULT '0',
	PRIMARY KEY (uid, gpmid)
) ENGINE = MYISAM DEFAULT CHARSET = utf8;

更改后:

CREATE TABLE pre_common_member_grouppm (
	uid MEDIUMINT (8) UNSIGNED NOT NULL DEFAULT '0',
	gpmid SMALLINT (6) UNSIGNED NOT NULL AUTO_INCREMENT,
	`status` TINYINT (1) NOT NULL DEFAULT '0',
	dateline INT (10) UNSIGNED NOT NULL DEFAULT '0',
	PRIMARY KEY (gpmid)
) ENGINE=InnoDB DEFAULT CHARSET = utf8;
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值