How to import existing *.sql files in PostgreSQL 8.4?

后端 未结 5 1845
悲哀的现实
悲哀的现实 2020-12-04 06:51

I am using PostgreSQL 8.4, and I have some *.sql files to import into a database. How can I do so?

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-04 07:08

    Well, the shortest way I know of, is following:

    psql -U {user_name} -d {database_name} -f {file_path} -h {host_name}
    

    database_name: Which database should you insert your file data in.

    file_path: Absolute path to the file through which you want to perform the importing.

    host_name: The name of the host. For development purposes, it is mostly localhost.

    Upon entering this command in console, you will be prompted to enter your password.

提交回复
热议问题