移动到 mysql8 后使用 mydumper 时出错,原因是用于换行的字符“\x0A”
error using mydumper since move to mysql8 caused by character `\x0A` used for new lines
我收到一个错误,似乎与在导入使用 mydumper
创建的备份期间未解释换行符有关。
- MySQL服务器版本:8.0.19-10
- mydumper 版本:mydumper 0.9.5,针对 MySQL 5.7.21-21
我试过以下方法:
myloader -d .
cat console.size-schema.sql | mysql console
ERROR 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;
mysql 使用 " 仅在 ANSI 模式下转义,默认情况下它使用反引号
How do I escape reserved words used as column names? MySQL/Create Table
我个人的偏好是在任何地方都使用反引号,因为此设置被广泛使用,使 mysql import/export 通过转储文件更容易
我收到一个错误,似乎与在导入使用 mydumper
创建的备份期间未解释换行符有关。
- MySQL服务器版本:8.0.19-10
- mydumper 版本:mydumper 0.9.5,针对 MySQL 5.7.21-21
我试过以下方法:
myloader -d .
cat console.size-schema.sql | mysql console
ERROR 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;
mysql 使用 " 仅在 ANSI 模式下转义,默认情况下它使用反引号
How do I escape reserved words used as column names? MySQL/Create Table
我个人的偏好是在任何地方都使用反引号,因为此设置被广泛使用,使 mysql import/export 通过转储文件更容易