我已经从本地MySQL数据库中导出了所有SQL,然后将其导入到外部数据库中。
DROP TABLE IF EXISTS `aspnetusers`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `aspnetusers` (
`Id` varchar(127) NOT NULL,
`UserName` varchar(256) DEFAULT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `UserNameIndex` (`NormalizedUserName`),
KEY `EmailIndex` (`NormalizedEmail`),
KEY `IX_AspNetUsers_GenderId` (`GenderId`),
KEY `IX_AspNetUsers_LanguageId` (`LanguageId`),
CONSTRAINT `FK_AspNetUsers_Genders_GenderId` FOREIGN KEY (`GenderId`)
REFERENCES `genders` (`id`) ON DELETE CASCADE,
CONSTRAINT `FK_AspNetUsers_Languages_LanguageId` FOREIGN KEY (`LanguageId`)
REFERENCES `languages` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
出于可读性原因,我缩短了SQL。这给出了错误消息密钥太长,最大长度为767。该表由aspnet生成,我在代码中将“修复”定义为127,但是当我从一个mysql导出到另一个mysql时我得到了错误。