psql --username=<db_user_name> databasename < data_base_dump
That's the command you are looking for.
Beware: databasename must be created before importing.
Have a look at the PostgreSQL Docs Chapter 23. Backup and Restore.
Videos
psql --username=<db_user_name> databasename < data_base_dump
That's the command you are looking for.
Beware: databasename must be created before importing.
Have a look at the PostgreSQL Docs Chapter 23. Backup and Restore.
Here is the command you are looking for.
psql -h hostname -d databasename -U username -f file.sql
I'm using postgresql in linux mint and trying to load an sql file to work with.
When I use
psql --set ON_ERROR_STOP=on demo < /home/masteruser/Downloads/demosmall.sql
I get the error
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: role "masteruser" does not exist
When I create the role of 'masteruser' with psql and try to run the command again it gives me
SET
SET
SET
SET
SET
SET
SET
SET
ERROR: cannot drop the currently open database
I heard a suggestion that I need to alter the pg_hba.conf but when I try to the system won't allow me because I don't have permission since its in the postgres group.