美文网首页
DBeaver备份数据库时报IO error: Process

DBeaver备份数据库时报IO error: Process

作者: 齐格Insight | 来源:发表于2024-09-14 23:04 被阅读0次

    背景

    DBeaver是个非常好用的数据库客户端软件,它有一个数据库备份的功能:

    image.png

    今天我在使用的时候报了如下的错误:

    2024-09-15 21:44:57.134 - IO error: Process failed (exit code = 2). See error log.
    2024-09-15 21:44:57.134 - java.io.IOException: Process failed (exit code = 2). See error log.
        at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.validateErrorCode(AbstractNativeToolHandler.java:263)
        at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.executeProcess(AbstractNativeToolHandler.java:241)
        at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.doExecute(AbstractNativeToolHandler.java:283)
        at org.jkiss.dbeaver.ext.mysql.tasks.MySQLNativeToolHandler.doExecute(MySQLNativeToolHandler.java:47)
        at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.lambda$0(AbstractNativeToolHandler.java:87)
        at org.jkiss.dbeaver.runtime.RunnableContextDelegate.lambda$0(RunnableContextDelegate.java:39)
        at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:124)
    

    升级到最新

    因为我的DBeaver客户端有点老, 以为是这个问题,升级到最新版本(24.2),升级完成后需要配置下Local Client

    image.png

    参考官方:
    https://dbeaver.com/docs/dbeaver/Local-Client-Configuration/

    升级后仍报错

    升级后仍报错,但错误更加详细,如下:

    /usr/local/mysql-8.0.32-macos13-arm64/bin/mysqldump --skip-lock-tables --routines --add-drop-table --disable-keys --extended-insert -u demouser --host=localhost --port=3308 demo
    Task 'MySQL dump' started at Sun Sep 15 21:44:56 CST 2024
    mysqldump: Got error: 1045: Access denied for user 'demo'@'localhost' (using password: YES) when trying to connect
    
    Task 'MySQL dump' finished at Sun Sep 15 21:44:56 CST 2024
    2024-09-15 21:44:57.134 - IO error: Process failed (exit code = 2). See error log.
    2024-09-15 21:44:57.134 - java.io.IOException: Process failed (exit code = 2). See error log.
        at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.validateErrorCode(AbstractNativeToolHandler.java:263)
        at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.executeProcess(AbstractNativeToolHandler.java:241)
        at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.doExecute(AbstractNativeToolHandler.java:283)
        at org.jkiss.dbeaver.ext.mysql.tasks.MySQLNativeToolHandler.doExecute(MySQLNativeToolHandler.java:47)
        at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.lambda$0(AbstractNativeToolHandler.java:87)
        at org.jkiss.dbeaver.runtime.RunnableContextDelegate.lambda$0(RunnableContextDelegate.java:39)
        at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:124)
    

    我们发现,其实它运行的是

    /usr/local/mysql-8.0.32-macos13-arm64/bin/mysqldump --skip-lock-tables --routines --add-drop-table --disable-keys --extended-insert -u demouser --host=localhost --port=3308 demo
    

    在运行这个命令的时候报错

    Access denied for user 'demo'@'localhost' (using password: YES) when trying to connect
    

    看起来是远程登录的权限问题,因为我本的 mysql 是通过 docker 启来的,我自己在 docker 的 terminal 下是可以登录mysql,说明不是用户名和密码的问题。而是远程登录设置有问题,导致不能通过 localhost 登录,将 localhost 换成 127.0.0.1 就可以登录了。

    成功后

    image.png

    相关文章

      网友评论

          本文标题:DBeaver备份数据库时报IO error: Process

          本文链接:https://www.haomeiwen.com/subject/cgxiljtx.html