如何恢复这个 1mb 的 sql 转储?
我用 pg_dump
转储了 1mb 的 sql,看起来
--
-- PostgreSQL database dump
--
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: app_address; Type: TABLE; Schema: public; Owner: me; Tablespace:
--
CREATE TABLE app_address (
...
现在我正在尝试恢复它。 文档说我可以使用我可以使用
psql dbname < infile
但这告诉我
psql: FATAL: no pg_hba.conf entry for host "[local]", user "me", database "mydb", SSL off
为什么会这样?我该如何修复这个错误?
I've got 1mb of sql that I dumped with pg_dump
, looks like
--
-- PostgreSQL database dump
--
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: app_address; Type: TABLE; Schema: public; Owner: me; Tablespace:
--
CREATE TABLE app_address (
...
Now I'm trying to restore it. The docs say I can use I can use
psql dbname < infile
But that tells me
psql: FATAL: no pg_hba.conf entry for host "[local]", user "me", database "mydb", SSL off
Why's that? How do I fix this error?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我经常遇到无法恢复 sql 转储的情况,除非我提供用户名,所以请尝试:
I rountinely experience being unable to restore a sql dump unless I supply a username, so try:
您需要配置 pg_hba.conf 以便允许您访问数据库。
将这一行添加到 pg_hba.conf 应该可以解决问题(我认为):
You need to configure pg_hba.conf so you are allowed to access the database.
Adding this line to pg_hba.conf should do the trick (I think):