繁体   English   中英

在SQL语句中查找语法错误

[英]Finding syntax error in SQL statement

我正在尝试将时钟api安装到我的服务器上并使其正常工作。 我正在尝试导入zip文件随附的一些表,但是我一直收到此错误:

Error
SQL query:

# if you would like to utilize a table prefix when creating these tables, be sure to reflect that in config.inc.php so the program
# will be aware of it. this option is $db_prefix. if you are unaware of what is meant by utilizing a 'table prefix', then please disregard.
#
# Table structure for table `audit`
#
CREATE TABLE audit(

modified_by_ip VARCHAR( 39 ) NOT NULL DEFAULT  '',
modified_by_user VARCHAR( 50 ) NOT NULL DEFAULT  '',
modified_when BIGINT( 14 ) NOT NULL ,
modified_from BIGINT( 14 ) NOT NULL ,
modified_to BIGINT( 14 ) NOT NULL ,
modified_why VARCHAR( 250 ) NOT NULL DEFAULT  '',
user_modified VARCHAR( 50 ) NOT NULL DEFAULT  '',
PRIMARY KEY ( modified_when ) ,
UNIQUE KEY modified_when( modified_when )
) TYPE = MYISAM ;

MySQL said: Documentation

#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 18 

这是我要上传的sql文件。

# if you would like to utilize a table prefix when creating these tables, be sure to reflect that in config.inc.php so the program
# will be aware of it. this option is $db_prefix. if you are unaware of what is meant by utilizing a 'table prefix', then please disregard.

#
# Table structure for table `audit`
#

CREATE TABLE audit (
  modified_by_ip varchar(39) NOT NULL default '',
  modified_by_user varchar(50) NOT NULL default '',
  modified_when bigint(14) NOT NULL, 
  modified_from bigint(14) NOT NULL,
  modified_to bigint(14) NOT NULL, 
  modified_why varchar(250) NOT NULL default '',
  user_modified varchar(50) NOT NULL default '',
  PRIMARY KEY  (modified_when), 
  UNIQUE KEY modified_when (modified_when)
) TYPE=MyISAM;

# --------------------------------------------------------

#
# Table structure for table `dbversion`
#

CREATE TABLE dbversion (
  dbversion decimal(5,1) NOT NULL default '0.0',
  PRIMARY KEY  (dbversion)
) TYPE=MyISAM;

#
# Dumping data for table `dbversion`
#

INSERT INTO dbversion VALUES ('1.4');

# --------------------------------------------------------

#
# Table structure for table `employees`
#

CREATE TABLE employees (
  empfullname varchar(50) NOT NULL default '',
  tstamp bigint(14) default NULL,
  employee_passwd varchar(25) NOT NULL default '',
  displayname varchar(50) NOT NULL default '',
  email varchar(75) NOT NULL default '',
  groups varchar(50) NOT NULL default '',
  office varchar(50) NOT NULL default '',
  admin tinyint(1) NOT NULL default '0',
  reports tinyint(1) NOT NULL default '0',
  time_admin tinyint(1) NOT NULL default '0',
  disabled tinyint(1) NOT NULL default '0',
  PRIMARY KEY  (empfullname)
) TYPE=MyISAM;

#
# Dumping data for table `employees`
#

INSERT INTO employees VALUES ('admin', NULL, 'xy.RY2HT1QTc2', 'administrator', '', '', '', 1, 1, 1, '');

# --------------------------------------------------------

#
# Table structure for table `groups`
#

CREATE TABLE groups (
  groupname varchar(50) NOT NULL default '',
  groupid int(10) NOT NULL auto_increment,
  officeid int(10) NOT NULL default '0',
  PRIMARY KEY  (groupid)
) TYPE=MyISAM;

# --------------------------------------------------------

#
# Table structure for table `info`
#

CREATE TABLE info (
  fullname varchar(50) NOT NULL default '',
  `inout` varchar(50) NOT NULL default '',
  timestamp bigint(14) default NULL,
  notes varchar(250) default NULL,
  ipaddress varchar(39) NOT NULL default '',
  KEY fullname (fullname)
) TYPE=MyISAM;

# --------------------------------------------------------

#
# Table structure for table `metars`
#

CREATE TABLE metars (
  metar varchar(255) NOT NULL default '',
  timestamp timestamp(14) NOT NULL,
  station varchar(4) NOT NULL default '',
  PRIMARY KEY  (station),
  UNIQUE KEY station (station)
) TYPE=MyISAM;

# --------------------------------------------------------

#
# Table structure for table `offices`
#

CREATE TABLE offices (
  officename varchar(50) NOT NULL default '',
  officeid int(10) NOT NULL auto_increment,
  PRIMARY KEY  (officeid)
) TYPE=MyISAM;

# --------------------------------------------------------

#
# Table structure for table `punchlist`
#

CREATE TABLE punchlist (
  punchitems varchar(50) NOT NULL default '',
  color varchar(7) NOT NULL default '',
  in_or_out tinyint(1) default NULL,
  PRIMARY KEY  (punchitems)
) TYPE=MyISAM;

#
# Dumping data for table `punchlist`
#

INSERT INTO punchlist VALUES ('in', '#009900', 1);
INSERT INTO punchlist VALUES ('out', '#FF0000', 0);
INSERT INTO punchlist VALUES ('break', '#FF9900', 0);
INSERT INTO punchlist VALUES ('lunch', '#0000FF', 0);

# --------------------------------------------------------

要明确指定要使用MyISAM表,请使用ENGINE表选项进行指示,如下所示:

CREATE TABLE t (i INT) ENGINE = MYISAM;

有关更多信息,请参考官方规范https://dev.mysql.com/doc/refman/5.7/en/create-table.html 祝您进口顺利:-)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM