About the author

Related Articles

5 Comments

  1. 1
    Ipsita

    Ipsita Upadhyay

    command prompt

    open your cmd window and type the following (make sure the path of postgres is correct)

    .”C:Program FilesPostgreSQL9.4binpsql.exe” -h 127.0.0.1 -p 5432 -U postgres -d dbname <./query.sql

    Reply
  2. 2
    Lucas

    Lucas Gervas

    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

    Reply
  3. 3
    pcent@email.null'

    pcent

    You should use psql command line tool:

    psql -h hostname -p port_number -U username -f your_file.sql databasename 
    
    Reply
  4. 4
    AmaChefe@email.null'

    AmaChefe

    click on the SQL Shell and log into the database and use import

    Server [localhost]:
    Database [postgres]:
    Port [5432]:
    Username [postgres]:
    Password for user postgres:
    psql (9.2.4)
    WARNING: Console code page (437) differs from Windows code page (1252)
             8-bit characters might not work correctly. See psql reference
             page "Notes for Windows users" for details.
    Type "help" for help.
    
    postgres=# i c:/data/data01.sql
    
    Reply
  5. 5
    Tom@email.null'

    Tom

    This also works for me:

    psql dbname username < file.sql
    
    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright © 2017 SolutionMmyself.com