错误执行任务write()参数必须是str,而不是字节MySQL工作台
在我开始使用 MySQL 工作台时全新安装 Windows 10 后,当我尝试转储数据库时出现此错误。
我在任何地方都找不到任何关于它的信息,我唯一发现的是 phyton 的问题,但与 Workbench 无关。
转储数据库后的输出:
08:29:00 Dumping foo(all tables)
Error executing task write() argument must be str, not bytes
08:29:01 Export of b'C:UserserickDocumentsdumpsDump20210121 (2).sql' has finished
输出文件是空白的,一些想法?
回答
您可以禁用(取消选中)选项create schema。这很烦人,但它有效。
- MySql Workbench is full of surprises
- Also annoying: having the whole backup fail on the target system because "ERROR 1049 (42000): Unknown database" because there was no CREATE SCHEMA.
回答
如果您有最新的 MySQL Workbench (8.0.23),只需卸载并安装 MySQL Workbench 8.0.20。那对我有用。
回答
此问题的另一个解决方法是编辑wb_admin_export.py.
在dump_to_folder(第1679行)中替换
self.out_pipe = open(path,"w")
和
self.out_pipe = open(path,"wb")
在dump_to_file(第1957行)中替换
self.out_pipe = open(self.path,"w")
和
self.out_pipe = open(self.path,"wb")