mysql error 1064

2019-03-06 17:03发布

Im trying to create a table with this code:

CREATE TABLE IF NOT EXISTS `entries` (
  `id` int(10) NOT NULL auto_increment,
  `atom_id` varchar(512) NOT NULL,
  `title` varchar(256) NOT NULL,
  `author` varchar(128) NOT NULL,
  `link` varchar(512) NOT NULL,
  `content` longtext NOT NULL,
  `updated` varchar(25) NOT NULL,
  `inserted` varchar(25) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `atom_id` (`atom_id`),
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `topics` (
  `id` int(10) NOT NULL auto_increment,
  `status` varchar(32) NOT NULL,
  `hub` varchar(512) NOT NULL,
  `topic` varchar(512) NOT NULL,
  `lease` varchar(25) NOT NULL,
  `secret` varchar(256) NOT NULL,
  `token` varchar(40) NOT NULL,
  `date` varchar(25) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

but i got this error:

#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 ') ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1' at line 12 

I can't figure what's going on, any advice?

2条回答
叼着烟拽天下
2楼-- · 2019-03-06 17:44

Remove the comma after UNIQUE KEY 'atom_id' ('atom_id'), in line 11

查看更多
一纸荒年 Trace。
3楼-- · 2019-03-06 17:54
UNIQUE KEY `atom_id` (`atom_id`),
                                ^

Try losing the ","

查看更多
登录 后发表回答