FlashChat安装打嗝! SQL语法错误?

时间:2016-03-04 09:03:21

标签: mysql sql syntax

我已经废除了(14)和(11),但在尝试安装tufat的Flashchat时,我不断收到此错误:

  

无法创建数据库表' smf_fc_bans'您的SQL中有错误   句法;查看与MySQL服务器版本对应的手册   正确的语法使用附近'(14)NOT NULL,userid int(11)   default NULL,banneduserid int(11)默认为NULL,r'在第1行

当然,我仍然是这样的新手。如果有人能帮助我,我会非常感激。

bans的表结构:

CREATE TABLE `bans` (
       `id` int NOT NULL auto_increment,
       `created` timestamp NOT NULL,
       `userid` int default NULL,
       `banneduserid` int default NULL,
       `roomid` int default NULL,
       `ip` varchar default NULL,
       KEY `id` (`id`),
       KEY `userid` (`userid`),
       KEY `created` (`created`)
     ) ENGINE=MyISAM;

connections的表结构:

CREATE TABLE `connections` (
       `id` varchar(32) NOT NULL default '',
       `updated` timestamp NOT NULL,
       `created` timestamp NOT NULL,
       `userid` int default NULL,
       `roomid` int default NULL,
       `state` tinyint(4) NOT NULL default '1',
       `color` int default NULL,
       `start` int default NULL,
       `lang` char(2) default NULL,
       `ip` varchar(16) default NULL,
       `tzoffset` int default '0',
       `chatid` int NOT NULL default '1',
       PRIMARY KEY  (`id`),
       KEY `userid` (`userid`),
       KEY `roomid` (`roomid`),
       KEY `updated` (`updated`)
     ) ENGINE=MyISAM;

ignors的表结构:

CREATE TABLE `ignors` (
       `created` timestamp NOT NULL,
       `userid` int default NULL,
       `ignoreduserid` int default NULL,
       KEY `userid` (`userid`),
       KEY `ignoreduserid` (`ignoreduserid`),
       KEY `created` (`created`)
     ) ENGINE=MyISAM;

messages的表结构:

CREATE TABLE `messages` (
       `id` int(11) NOT NULL auto_increment,
       `created` timestamp NOT NULL,
       `toconnid` varchar(32) default NULL,
       `touserid` int(11) default NULL,
       `toroomid` int(11) default NULL,
       `command` varchar(255) NOT NULL default '',
       `userid` int default NULL,
       `roomid` int(11) default NULL,
       `txt` text,
       PRIMARY KEY  (`id`),
       KEY `touserid` (`touserid`),
       KEY `toroomid` (`toroomid`),
       KEY `toconnid` (`toconnid`),
       KEY `created` (`created`)
     ) ENGINE=MyISAM AUTO_INCREMENT=14 ;

rooms的表结构:

CREATE TABLE `rooms` (
       `id` int NOT NULL auto_increment,
       `updated` timestamp NOT NULL,
       `created` timestamp NOT NULL,
       `name` varchar(64) NOT NULL default '',
       `password` varchar(32) NOT NULL default '', 
       `ispublic` char(1) default NULL,
       `ispermanent` int(11) default NULL,

       PRIMARY KEY  (`id`),
       KEY `name` (`name`),
       KEY `ispublic` (`ispublic`),
       KEY `ispermanent` (`ispermanent`),
       KEY `updated` (`updated`)
     ) WNGINW=MyISAM AUTO_INCREMENT=5 ;

users的表结构:

CREATE TABLE `users` (
       `id` int NOT NULL auto_increment,
       `login` varchar(32) NOT NULL default '',
       `password` varchar(32) NOT NULL default '',
       `roles` int NOT NULL default '0',
       `profile` text,
       PRIMARY KEY  (`id`),
       KEY `login` (`login`)
     ) ENGINE=MyISAM AUTO_INCREMENT=2 ;`

1 个答案:

答案 0 :(得分:0)

varchar数据类型需要varchar(50)

之类的参数
CREATE TABLE `bans` (
       `id` int NOT NULL auto_increment,
       `created` timestamp NOT NULL,
       `userid` int default NULL,
       `banneduserid` int default NULL,
       `roomid` int default NULL,
       `ip` varchar( requires a number ) default NULL,    <-- HERE
       KEY `id` (`id`),
       KEY `userid` (`userid`),
       KEY `created` (`created`)
     ) ENGINE=MyISAM;

中也有错误
CREATE TABLE `rooms` (
       `id` int NOT NULL auto_increment,
       `updated` timestamp NOT NULL,
       `created` timestamp NOT NULL,
       `name` varchar(64) NOT NULL default '',
       `password` varchar(32) NOT NULL default '', 
       `ispublic` char(1) default NULL,
       `ispermanent` int(11) default NULL,

       PRIMARY KEY  (`id`),
       KEY `name` (`name`),
       KEY `ispublic` (`ispublic`),
       KEY `ispermanent` (`ispermanent`),
       KEY `updated` (`updated`)
     ) WNGINW=MyISAM AUTO_INCREMENT=5 ;

WNGINW=MyISAM AUTO_INCREMENT=5 ;

应该是

ENGINE=MyISAM AUTO_INCREMENT=5 ;