Open terminal.
Connect to psql:
psql -p 5433
I find it easier to delete and recreate the DB to which you want to import. So ensure the databse you want to delete is listed:
\l
Delete the database:
drop database DB_2;
Re-create it:
create databse DB_2;
Quit PSQL. We are done with it for now:
\q
Import the data to the newly created database:
psql -h 127.0.0.1 -U postgres -p 5433 DB_2 < /Path/To/file/DB-2-new-dump-file.dump
Optionally, to dump a DB, use these commands:
pg_dump -U postgres -n schema-name -s digilex > path/to/file.sql
pg_dump -U postgres -t table-name digilex > path/to/file.sql
pg_dump -h digilex.co.za -p 5433 -U postgres -v dev > /Users/MacBook/Desktop/devDump.sql
psql -h 127.0.0.1 -U postgres -p 5433 digilex < /Users/MacBook/Desktop/dump-file-name.dump
Thank you! 👍🏻