Importing .sql file on windows to postgresql

前端 未结 7 1634
春和景丽
春和景丽 2020-12-25 12:23

I have a .sql file that was created by postgresql a while back. I now want to import this file onto a windows machine running postgresql.

How do I do this. The file

7条回答
  •  天涯浪人
    2020-12-25 13:06

    start you psql command tool, it will give you dialog like the following

    Server [localhost]:
    Database [postgres]:
    Port [5432]:yourport
    Username [postgres]:
    Password for user postgres:**********
    

    then connect to your database

    postgres=# \c yourdatabase;
    

    then import the file

    yourdatabase=# \i c:/path/path/data/data01.sql
    

    note the / for directory separator & no spaces in file path

提交回复
热议问题