postgresqlphppgadmin

How to run a .sql file with phppgadmin or psql


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


Solution

  • 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.