How to restore this 1mb sql dump?
I've got 1mb of sql that I dumped with pg_dump
, looks like
--
-- PostgreSQL database dump
--
开发者_如何学GoSET 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?
I rountinely experience being unable to restore a sql dump unless I supply a username, so try:
psql -U <username> <database> < <infile>
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):
host all all localhost trust
精彩评论