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

PostgreSQL运行SQL文件提示No such file or directory错误解决方案

问题描述

我在psql shell中运行sql文件时,抛出了*"No such file or directory"*错误,报错场景复现如下:

$ ls
config.sql  config.yaml

$ sudo -i -u postgres psql

postgres=# \i config.sql

config.sql: No such file or directory

快速解决方案

命令中-i参数会切换到postgres用户的家目录,因此当前路径下的config.sql地址无效,使用如下命令即可解决:

$ psql -U <user_name>

postgres=# \i config.sql

内容的提问来源于stack exchange,提问作者user16662077

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.10.07 10:12:04