0

While importing .sql file in phppgadmin it produces an error

"Import error: Failed to automatically determine the file format".

How to import the file?

And in terminal it shows as

postgres-# \i Documents/sample.sql

Documents/sample.sql: No such file or directory

But the file exists in the particular location. How to import .sql file in Postgresql and in Phppgadmin

Rajasree
  • 35
  • 4

2 Answers2

0

You can do this by command line:

Get login with your psql through command line and
just run the following command in your terminal

psql 'databasename' < 'database_dump'

just replace 'databasename' with your database and 'database_dump' with the file you want to import.

Amrinder Singh
  • 5,300
  • 12
  • 46
  • 88
0

You can run a file using below command

psql -U postgres -d postgres -a -f ./test.sql

or if you have to pass a host

psql -h -p 5432 -U postgres -d -a -f ./test2.sql

You can refer this blog https://trueway-blog.com/run-sql-file-with-psql/