create postgres database from sql file code example
Example 1: create postgres database
sudo -u postgres psql
postgres=# create database mydb;
postgres=# create user myuser with encrypted password 'mypass';
postgres=# grant all privileges on database mydb to myuser;
Example 2: restore postgres database from sql file
psql -d database_name -f backup.sql