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
相关产品推荐
相关产品推荐

