You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用IAP隧道连接GCloud Compute实例时触发DatabaseError错误

解决gcloud命令报DatabaseError: file is not a database的问题

这个错误是gcloud本地配置数据库损坏导致的,直接按下面的步骤修复:

  • 备份现有配置(可选但推荐)
    先把当前的gcloud配置目录备份,避免丢失自定义设置:

    cp -r ~/.config/gcloud ~/.config/gcloud_backup
    
  • 重置默认配置
    执行重置命令修复损坏的数据库文件:

    gcloud config configurations reset default
    
  • 如果重置无效,彻底重建配置
    先删除损坏的配置目录,再重新初始化gcloud:

    rm -rf ~/.config/gcloud
    gcloud init
    

    跟着初始化向导重新登录账号、选择项目和区域即可。

  • 额外建议:更新gcloud到最新版本
    旧版本可能存在已知bug,更新到最新版能避免类似问题:

    gcloud components update
    

本质原因是gcloud依赖的本地SQLite配置文件因磁盘异常、进程意外终止等原因损坏,导致无法读取配置,重置或重建配置就能解决。

内容的提问来源于stack exchange,提问作者Fidelius von Manstein

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.18 03:14:49