Install postgres
sudo apt install postgresql-12 libpq-dev
Create a postgres user
This command will create a super user who has lots of permissions and makes life easier for us. In a production setup you probably don't want that.
sudo -u postgres createuser yourchosenusername -s
Change postgres user password
Switch to the postgres console and change your newly created user's password.
sudo -u postgres psql
You'll see the prompt change to postgres=#
, then type
\password yourchosenusername
You will be prompted to enter the password twice and you won't see what you're typing. Confirm with enter
and exit the psql console with ctrl+d
.
Database credentials
You should now have everything to let your app talk to your local postgres.
- username: yourchosenusername
- password: yourchosenpassword
- host: localhost
- port: 5432
or as URL string postgresql://username:password@localhost:5432/databasename
(where databasename is your application's database name)