I don't think OS X has a root user per se. Semantics aside, yes it is ok to connect under your username. By default this role will not have superuser privileges. If you need to make superuser type changes (adding/dropping databases, granting access, those kinds of things), the customary way to do this is to use
su postgres
to switch users to the entitled user, then usepsql
.By default, postgres uses unix usernames for authentication. If you want to use username/passwords instead you need to change settings in
pg_hba.conf
per my answer here.I am not very familiar with pgAdmin--wish I could help.
Getting started with postgres.app for Django application development
-
30-06-2022 - |
Question
I'm a newbie trying to get started with postgres.app. I want to make sure I'm laying the proper foundation for the eventual deployment of a Django application to Heroku.
I've followed the steps in the postgres.app documentation but have a few additional questions:
In my development environment (on a personal osx machine) is it okay to have the Django application connect to the database as the default/root user ($USER) without a password?
If I wanted to set up a password for the default/root user, how should I go about doing so? I've attempted
ALTER USER [username] with password '[password]';
and modifying~/Library/Containers/com.heroku.postgres/Data/Library/Application Support/Postgres/var/pg_hba.conf
with no success: enteringpsql
in the terminal still provides unauthenticated access to the postgres shell.What is the correct way to connect to the postgres.app server with pgAdmin. My current setup is as follows. I suppose I'm mostly concerned with whether the
Maintenance DB
setting is correct:Name: development
Host: localhost
Port: 5432
Maintenance DB: [$USER] # i.e., "joe"... should this be "postgres" instead?
Username: [$USER]
Password:
Many thanks, and any additional advice is always appreciated!
Solution