Ich versuche, Datenbank-Dump in meine Datenbank mariaDb 10.2.6 zu importieren. Es ist eine Magento 2-Datenbank.Import-Tabelle mit primären auto_increment Wert Null auf Mariadb
Es ist diese Tabelle importieren:
# Dump of table store_website
# ------------------------------------------------------------
DROP TABLE IF EXISTS `store_website`;
CREATE TABLE `store_website` (
`website_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Website Id',
`code` varchar(32) DEFAULT NULL COMMENT 'Code',
`name` varchar(64) DEFAULT NULL COMMENT 'Website Name',
`sort_order` smallint(5) unsigned NOT NULL DEFAULT 0 COMMENT 'Sort Order',
`default_group_id` smallint(5) unsigned NOT NULL DEFAULT 0 COMMENT 'Default Group Id',
`is_default` smallint(5) unsigned DEFAULT 0 COMMENT 'Defines Is Website Default',
PRIMARY KEY (`website_id`),
UNIQUE KEY `STORE_WEBSITE_CODE` (`code`),
KEY `STORE_WEBSITE_SORT_ORDER` (`sort_order`),
KEY `STORE_WEBSITE_DEFAULT_GROUP_ID` (`default_group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Websites';
LOCK TABLES `store_website` WRITE;
/*!40000 ALTER TABLE `store_website` DISABLE KEYS */;
INSERT INTO `store_website` (`website_id`, `code`, `name`, `sort_order`, `default_group_id`, `is_default`)
VALUES
(0,'admin','Admin',0,0,0),
(1,'my_website','MY_WEBSITE',0,1,1);
/*!40000 ALTER TABLE `store_website` ENABLE KEYS */;
UNLOCK TABLES;
Dies versagt mir einen doppelten Schlüssel 1 Fehler geben. Offensichtlich versucht es, den Wert 0 als neues Inkrement einzufügen, das wäre 1, aber das ist bereits in der Tabelle. Dieser Fehler wird angezeigt, obwohl diese Optionen festgelegt sind:
/*!40101 SET @[email protected]@CHARACTER_SET_CLIENT */;
/*!40101 SET @[email protected]@CHARACTER_SET_RESULTS */;
/*!40101 SET @[email protected]@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @[email protected]@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @[email protected]@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @[email protected]@SQL_NOTES, SQL_NOTES=0 */;
die Null kommt aus dem Framework, das ich benutze, nicht sicher, warum sie es verwenden. vielleicht ist es Teil eines Benutzerfehlers, wo es erwartet wurde, dass auto_increment mit 1. beginnt, aber auf 0 gesetzt wurde? – DarsVaeda
Grrr ... Ein weiterer Fall, in dem ein Framework in die Quere kommt. –