通过工具 DBeaver操作 MySQL8.0 导入备份的 sql 报错
1.报错
`2022-06-22 16:23:14.482 - IO error: Process failed (exit code = 1). See error log.
2022-06-22 16:23:14.482 - java.io.IOException: Process failed (exit code = 1). See error log.
at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.validateErrorCode(AbstractNativeToolHandler.java:242)
at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.executeProcess(AbstractNativeToolHandler.java:223)
at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.doExecute(AbstractNativeToolHandler.java:262)
at org.jkiss.dbeaver.ext.mysql.tasks.MySQLNativeToolHandler.doExecute(MySQLNativeToolHandler.java:47)
at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.lambda$0(AbstractNativeToolHandler.java:83)
at org.jkiss.dbeaver.runtime.RunnableContextDelegate.lambda$0(RunnableContextDelegate.java:39)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)`
2.解决方法
mysql 默认以 gbk 编码连接数据库,之前导出备份文件是 utf8 编码,编码不一致导致错误。
在执行脚本之前配置一下,加上指定编码执行即可。
--default-character-set=utf8mb4