我收到了一个错误,它似乎与导入使用mydumper创建的备份时未解释的新行字符有关。
8.0.19-10
构建
我尝试了以下几点:
myloader -d .cat console.size-schema.sql | mysql consoleERROR 1064 (42000) at line 4: 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 '"size" (\x0A "id" int NOT NULL AUTO_INCREMENT,\x0A "name" varchar(255) NOT NUL' at line 1当我使用cat时,这个文件看起来很正常
$ cat console.size-schema.sql
/*!40101 SET NAMES binary*/;
/*!40014 SET FOREIGN_KEY_CHECKS=0*/;
/*!40103 SET TIME_ZONE='+00:00' */;
CREATE TABLE "size" (
"id" int NOT NULL AUTO_INCREMENT,
"name" varchar(255) NOT NULL,
"label" varchar(255) DEFAULT NULL,
"width" int DEFAULT NULL,
"height" int DEFAULT NULL,
"depth" int DEFAULT NULL,
"deleted_at" int DEFAULT NULL,
"created_at" int DEFAULT NULL,
"updated_at" int DEFAULT NULL,
PRIMARY KEY ("id")
) ENGINE=InnoDB AUTO_INCREMENT=522 DEFAULT CHARSET=utf8;发布于 2020-09-26 11:42:27
mysql使用“仅在ANSI模式下转义,默认情况下它使用回勾号”。
How do I escape reserved words used as column names? MySQL/Create Table
我个人的首选是在任何地方使用回勾,因为这个设置被广泛使用,使得mysql通过转储文件导入/导出更容易。
https://stackoverflow.com/questions/64073809
复制相似问题