Import SQL dump into PostgreSQL database

前端 未结 15 1606
我寻月下人不归
我寻月下人不归 2020-12-04 04:23

We are switching hosts and the old one provided a SQL dump of the PostgreSQL database of our site.

Now, I\'m trying to set this up on a local WAMP server to test thi

相关标签:
15条回答
  • 2020-12-04 05:13

    I had more than 100MB data, therefore I could not restore database using Pgadmin4.

    I used simply postgres client, and write below command.

    postgres@khan:/$ pg_restore -d database_name /home/khan/Downloads/dump.sql

    It worked fine and took few seconds.You can see below link for more information. https://www.postgresql.org/docs/8.1/app-pgrestore.html

    0 讨论(0)
  • 2020-12-04 05:16

    Just for funsies, if your dump is compressed you can do something like

    gunzip -c filename.gz | psql dbname

    As Jacob mentioned, the PostgreSQL docs describe all this quite well.

    0 讨论(0)
  • 2020-12-04 05:16

    I use:

    cat /home/path/to/dump/file | psql -h localhost -U <user_name> -d <db_name>
    

    Hope this will help someone.

    0 讨论(0)
提交回复
热议问题