运行时出现MySQL错误

时间:2015-08-19 04:32:58

标签: mysql

每次运行SQL时都会出错。

INSERT INTO `permissions_ranks` VALUES ('1', '30', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');
[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 '',
  `user_enter_full_rooms` enum('0','1') NOT NULL DEFAULT '0',
  `user_can_r' at line 14

这是我的SQL:

DROP TABLE IF EXISTS `permissions_ranks`;
CREATE TABLE `permissions_ranks` (
  `rank` int(1) unsigned NOT NULL,
  `floodtime` int(2) NOT NULL DEFAULT '30',
  `support_tool` enum('0','1') NOT NULL DEFAULT '0',
  `ambassadeur` enum('0','1') NOT NULL DEFAULT '0',
  `moderator` enum('0','1') NOT NULL DEFAULT '0',
  `manager` enum('0','1') NOT NULL DEFAULT '0',
  `admin` enum('0','1') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0',
  `staff_chat` enum('0','1') NOT NULL DEFAULT '0',
  `user_is_staff` enum('0','1') NOT NULL DEFAULT '0',
  `user_not_kickable` enum('0','1') NOT NULL DEFAULT '0',
  `user_can_change_name` enum('0','1') NOT NULL DEFAULT '0',
  `user_enter_full_rooms` enum('0','1') NOT NULL DEFAULT '0',
  `user_enter_any_room` enum('0','1') NOT NULL DEFAULT '0')',
  `user_enter_full_rooms` enum('0','1') NOT NULL DEFAULT '0',
  `user_can_read_whisper` enum('0','1') NOT NULL DEFAULT '0',
  `user_room_staff_pick` enum('0','1') NOT NULL DEFAULT '0',
  `cmd_global_refresh_permissions` enum('0','1') NOT NULL DEFAULT '0',
  `cmd_user_can_give_currency` enum('0','1') NOT NULL DEFAULT '0',
  `modtool_can_read_chatlog` enum('0','1') NOT NULL DEFAULT '0',
  `modtool_can_send_alert` enum('0','1') NOT NULL DEFAULT '0',
  `modtool_can_ban_user` enum('0','1') NOT NULL DEFAULT '0',
  `modtool_can_kick_user` enum('0','1') NOT NULL DEFAULT '0',
  PRIMARY KEY (`rank`),
  UNIQUE KEY `rank` (`rank`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

- permissions_ranks的记录

INSERT INTO `permissions_ranks` VALUES ('1', '30', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `permissions_ranks` VALUES ('2', '30', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `permissions_ranks` VALUES ('3', '30', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `permissions_ranks` VALUES ('4', '30', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `permissions_ranks` VALUES ('5', '30', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `permissions_ranks` VALUES ('6', '30', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `permissions_ranks` VALUES ('7', '30', '1', '1', '1', '1', '1', '1', '1', '1', '1', '0', '1', '1', '1', '1', '1', '1', '1');

1 个答案:

答案 0 :(得分:0)

> Actually you are having the  duplicate column for the
> 'user_enter_full_rooms' in creating the table.
> 
> 
> Due to the not null column for the all the fields you need enter all
> the values.

    INSERT INTO permissions_ranks VALUES ('1', '30', '0', '0', '0', '0', '0','0','0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO permissions_ranks VALUES ('2', '30', '0', '0', '0', '0', '0','0','0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO permissions_ranks VALUES ('3', '30', '0', '0', '0', '0', '0','0','0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO permissions_ranks VALUES ('4', '30', '0', '0', '0', '0', '0','0','0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO permissions_ranks VALUES ('5', '30', '0', '0', '0', '0', '0','0','0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO permissions_ranks VALUES ('6', '30', '0', '0', '0', '0', '0','0','0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO permissions_ranks VALUES('7', '30', '1', '1','1','1', '1', '1', '1', '1', '1', '1', '1', '0', '1', '1', '1', '1', '1', '1', '1');