• 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;
    
  • 相关阅读:
    在WINDOWS任务计划程序下执行PHP文件 PHP定时功能的实现
    使用Sublime Text 3进行Markdown 编辑+实时预览
    ni_set()函数的使用 以及 post_max_size,upload_max_filesize的修改方法
    CORS跨域的概念与TP5的解决方案
    tp5模型笔记---多对多
    微信小程序 GMT+0800 (中国标准时间) WXSS 文件编译错误
    ESP8266 LUA脚本语言开发: 外设篇-GPIO输入检测
    ESP8266 LUA脚本语言开发: 外设篇-GPIO输出高低电平
    ESP8266 LUA脚本语言开发: 准备工作-LUA文件加载与变量调用
    ESP8266 LUA脚本语言开发: 准备工作-LUA开发说明
  • 原文地址:https://www.cnblogs.com/javakfz/p/13938225.html
Copyright © 2020-2023  润新知