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


    安装成功后发帖报错:
    (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;
    
  • 相关阅读:
    vim的使用
    linux 环境下,kafka_2.123.0.0 集群搭建
    NetCore3.1 ping网络是否畅通及获取服务器Cpu、内存使用率
    使用kafkatool连接使用Kafka
    NetCore3.1 制作windows服务
    kafka_2.123.0.0 版本Topic、producer 命令记录
    NetCore 控制台应用程序依赖注入
    使用 contentvisibility 优化渲染性能
    有意思的鼠标指针交互探究
    linux中如何将多条命令写入在一行中,其中包括while语句,同时,在k8s的command中如何来使用
  • 原文地址:https://www.cnblogs.com/javakfz/p/13938225.html
Copyright © 2020-2023  润新知