I've installed postgresql on Ubuntu using:
$ sudo apt install postgresql
Now I have a series of SQL queries that I would like to run to create schemas, users, tables, and so on. I've put these queries in a .sql file as below:
$ sudo nano postgressetup.sql CREATE SCHEMA schma; CREATE USER a2i WITH PASSWORD & # 39; password & # 39 ;; GRANT CONNECT ON DATABASE postgres TO schma;
This file contains all queries. I have tried something like:
$ psql -U postgres -d postgres -a -f postgressetup.sql
and received an error:
psql: FATAL: Peer authentication failed for the user "postgres"
I want to know how to run this .sql file.
Note: I just installed Postgres and no other operation is performed on it. Any help is appreciated.