Mysql 1062个重复条目';0';对于键';初级';
我简直搞不清楚到底出了什么问题。当尝试将数据插入表Mysql 1062个重复条目';0';对于键';初级';,mysql,Mysql,我简直搞不清楚到底出了什么问题。当尝试将数据插入表类别名称时,我得到了键“PRIMARY”的重复条目“0”。我已检查列ID是否为AUTO INCREMENT和PRIMARY键 我是否可以从insert语句中省略列名ID,这样就可以了 它在另一个托管平台上工作,但自从我搬到siteground后,我遇到了一个奇怪的错误 我知道列名称accessbile是一个保留关键字,但更改它并没有什么区别 表格结构: CREATE TABLE IF NOT EXISTS `category_names` (
类别名称时,我得到了键“PRIMARY”的重复条目“0”
。我已检查列ID
是否为AUTO INCREMENT
和PRIMARY
键
我是否可以从insert语句中省略列名ID
,这样就可以了
它在另一个托管平台上工作,但自从我搬到siteground后,我遇到了一个奇怪的错误
我知道列名称accessbile是一个保留关键字,但更改它并没有什么区别
表格结构:
CREATE TABLE IF NOT EXISTS `category_names` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`category_id` int(11) NOT NULL DEFAULT '0',
`locale_id` int(11) NOT NULL,
`status` enum('1','0') NOT NULL DEFAULT '1',
`accessible` enum('1','0') NOT NULL DEFAULT '1',
`type` int(11) NOT NULL,
`filter` int(11) NOT NULL,
`offer_image` varchar(255) NOT NULL DEFAULT 'none',
`uri` varchar(255) NOT NULL,
`browser_title` varchar(255) NOT NULL,
`meta_description` text NOT NULL,
`meta_keywords` text NOT NULL,
`title` varchar(255) NOT NULL,
`description` text NOT NULL,
`extra1` text NOT NULL,
`extra2` text NOT NULL,
`extra3` text NOT NULL,
`extra4` text NOT NULL,
`offer` int(11) NOT NULL,
`offer_activate` int(11) NOT NULL,
`offer_product` varchar(255) NOT NULL,
`offer_product_qty` int(11) NOT NULL,
`offer_percent` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=685;
Database_Exception [ 1062 ]: Duplicate entry '0' for key 'PRIMARY' [ INSERT INTO `category_names` (`category_id`, `locale_id`, `status`, `accessible`, `type`, `filter`, `offer_image`, `uri`, `browser_title`, `meta_description`, `meta_keywords`, `title`, `description`, `extra1`, `extra2`, `extra3`, `extra4`, `offer`, `offer_activate`, `offer_product`, `offer_product_qty`, `offer_percent`) VALUES (724, 1, '1', '1', '0', '0', 'none', 'test2', '', '', '', 'test2', '', '', '', '', '', '1', 0, '', 0, 0) ]
错误:
CREATE TABLE IF NOT EXISTS `category_names` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`category_id` int(11) NOT NULL DEFAULT '0',
`locale_id` int(11) NOT NULL,
`status` enum('1','0') NOT NULL DEFAULT '1',
`accessible` enum('1','0') NOT NULL DEFAULT '1',
`type` int(11) NOT NULL,
`filter` int(11) NOT NULL,
`offer_image` varchar(255) NOT NULL DEFAULT 'none',
`uri` varchar(255) NOT NULL,
`browser_title` varchar(255) NOT NULL,
`meta_description` text NOT NULL,
`meta_keywords` text NOT NULL,
`title` varchar(255) NOT NULL,
`description` text NOT NULL,
`extra1` text NOT NULL,
`extra2` text NOT NULL,
`extra3` text NOT NULL,
`extra4` text NOT NULL,
`offer` int(11) NOT NULL,
`offer_activate` int(11) NOT NULL,
`offer_product` varchar(255) NOT NULL,
`offer_product_qty` int(11) NOT NULL,
`offer_percent` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=685;
Database_Exception [ 1062 ]: Duplicate entry '0' for key 'PRIMARY' [ INSERT INTO `category_names` (`category_id`, `locale_id`, `status`, `accessible`, `type`, `filter`, `offer_image`, `uri`, `browser_title`, `meta_description`, `meta_keywords`, `title`, `description`, `extra1`, `extra2`, `extra3`, `extra4`, `offer`, `offer_activate`, `offer_product`, `offer_product_qty`, `offer_percent`) VALUES (724, 1, '1', '1', '0', '0', 'none', 'test2', '', '', '', 'test2', '', '', '', '', '', '1', 0, '', 0, 0) ]
更新:
CREATE TABLE IF NOT EXISTS `category_names` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`category_id` int(11) NOT NULL DEFAULT '0',
`locale_id` int(11) NOT NULL,
`status` enum('1','0') NOT NULL DEFAULT '1',
`accessible` enum('1','0') NOT NULL DEFAULT '1',
`type` int(11) NOT NULL,
`filter` int(11) NOT NULL,
`offer_image` varchar(255) NOT NULL DEFAULT 'none',
`uri` varchar(255) NOT NULL,
`browser_title` varchar(255) NOT NULL,
`meta_description` text NOT NULL,
`meta_keywords` text NOT NULL,
`title` varchar(255) NOT NULL,
`description` text NOT NULL,
`extra1` text NOT NULL,
`extra2` text NOT NULL,
`extra3` text NOT NULL,
`extra4` text NOT NULL,
`offer` int(11) NOT NULL,
`offer_activate` int(11) NOT NULL,
`offer_product` varchar(255) NOT NULL,
`offer_product_qty` int(11) NOT NULL,
`offer_percent` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=685;
Database_Exception [ 1062 ]: Duplicate entry '0' for key 'PRIMARY' [ INSERT INTO `category_names` (`category_id`, `locale_id`, `status`, `accessible`, `type`, `filter`, `offer_image`, `uri`, `browser_title`, `meta_description`, `meta_keywords`, `title`, `description`, `extra1`, `extra2`, `extra3`, `extra4`, `offer`, `offer_activate`, `offer_product`, `offer_product_qty`, `offer_percent`) VALUES (724, 1, '1', '1', '0', '0', 'none', 'test2', '', '', '', 'test2', '', '', '', '', '', '1', 0, '', 0, 0) ]
我删除了那张桌子上的触发器。它似乎已经解决了这个问题。我将进一步测试。我将试用您的表和插入代码。。我也没有错..它在Cudos运行得很好