Unable to connect to Greenplum Database using user other than gpadmin - greenplum

I am following this tutorial: http://gpdb.docs.pivotal.io/4340/admin_guide/client_auth.html
I have created user abc as superuser.
I have added following line in pg_hba.conf.
# IPv6 local connections:
#
host all all 0.0.0.0/0 password
local all abc 127.0.0.1/28 password
local all gpadmin ident
host all gpadmin 127.0.0.1/28 trust
host all gpadmin 10.*.*.*/32 trust
host all gpadmin ::1/128 trust
host all gpadmin fe80::*****/128 trust
local replication gpadmin ident
host replication gpadmin samenet trust
In postgresql.conf, I have added listen_addresses = '*' and reloaded the config by gpstop -u but still its not working. Please let me know what I am missing here.

Related

Docker PostgreSQL: cannot connect to the server on Windows 7

I run on Windows 10
docker run -it --rm -e POSTGRES_PASSWORD=postgres -p5401:5432 postgres:12.3-alpine
it works fine. I can connect to PostgreSQL, create database etc, all is ok.
But when I run the same docker on my 2nd machine Windows 7 I receive
Could not connect to server: Connection refused (0x0000274D/10061) Is
the server running on host "localhost" (::1) and accepting TCP/IP
connections on port 5401?
What may be the reason? what to check?
That is pg_hba.conf
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all trust
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust
host all all all md5
I would say the possible issues are:
1) The server has not actually been started in the Docker server.
Verify server is running.
2) Port 5401 is not visible to the client that is trying to connect.
Ping the port. Could be a firewall issue.

Trying to connect Postgresql remotely(windows OS)

New to PostgreSQL and running PostgreSQL on windows
I have a PostgreSQL running locally on a remote machine and also a PostgreSQL on my laptop(win 10)(same LAN), trying to connect to the remote PostgreSQL from my laptop but getting the error
no pg_hba.conf entry for host "xxx.xxx.x.xxx", user "postgres", database "postgres", SSL off
I can telnet the remote machine with port 5432
telnet xxx.xxx.x.xxx 5432 is OK ,for testing purpose ,I have given all for the connection and also my PostgreSQL installation/configuration is default on my laptop and on the remote machine . Not sure how to dig the issue here, is there any issue of running services locally without specific ip is a problem?
when I run select(host(inet_server_add r())) my o/p is just ::1
My pg_hba file is as below ,
#IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all all md5
#IPv6 local connections:
host all all ::1/128 md5
#Allow replication connections from localhost, by a user with the
replication privilege.
host replication all 127.0.0.1/32 md5
host replication all ::1/128 md5

Postgresql (PgAdmin4) password changed (without me telling it to) on my local and I now cannot log in

I was working on our company's new API build for the last 6 months and when I was made aware of a problem with our existing system. I tried to access my local env again to try to debug and found my local DB locked down for an unknown reason with a password that was not root (the initial password I set). Now, I cannot log in at all to my local DB server and editing the pg_hba.conf file and restarting the server did nothing. It was still asking for a password. Any advice is greatly appreciated. specs and screenshot below:
Environment: Windows 10 Pro
Codebase Language: Elixir
DB: postgresql 10
Port: 5432
config :rog_api, RogApi.Repo,
adapter: Ecto.Adapters.Postgres,
username: "postgres",
password: "root",
database: "rog_api_local",
hostname: "localhost",
pool_size: 18
pg_hba.conf file:
# TYPE DATABASE USER ADDRESS METHOD
host all all all trust
# IPv4 local connections:
#host all all 127.0.0.1/32 md5
# IPv6 local connections:
#host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#host replication all 127.0.0.1/32 md5
#host replication all ::1/128 md5

How to use psql as postgres (asks for password, but I don't have one)?

I have installed Postgres using HomeBrew and I try to create a new user in it.
I try to use psql to create a new user and database in Postgres, so first I try to open up it by using sudo -u postgres psql, but it prompts me for a password. As far as I know there should be no password for this user by default.
I also tried to edit my pg_hba.conf, but this also seems fine for me:
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all trust
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust
Why does it keep prompting me a password (if there is a password what should be it)? If I simply try to run psql to log in using my current system user instead of postgres, and then provide my current user's password, that doesn't work either (I am on macOS by the way).

Could not connect to Postgresql on Mac OS X after Installation

So I installed Postgresql onto my Mac and whenever I run anything like psql or createdb cool_database_name I get the following error.
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
So I follow along the different solutions. I reinstall postgresql to no avail. I go to postgresql.conf` and change it to
#port = 5432 # (change requires restart)
#max_connections = 20 # (change requires restart)
# Note: Increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction).
#superuser_reserved_connections = 3 # (change requires restart)
#unix_socket_directory = '/var/pgsql_socket' # (change requires restart)
#unix_socket_group = '' # (change requires restart)
#unix_socket_permissions = 0777 # begin with 0 to use octal notation
yet still nothing. I run commands such as
ls -lA /var/run/postgresql
Which tell me the file or directory does not exist.
I also check into the pg_hba.conf file but everything looks ok
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication jason trust
#host replication jason 127.0.0.1/32 trust
#host replication jason ::1/128 trust
When I run psql -h localhost I get
psql: could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (fe80::1) and accepting
TCP/IP connections on port 5432?
I'm at a lost as to how to fix this. Any help would be appreciated.
The problem is that Mac OS ships PostgreSQL
$ `which psql` --version
psql (PostgreSQL) 9.1.4
contains support for command-line editing
You need change PATH like this:
export PATH="path_to_bin_folder_of_your_new_postgres_install:$PATH"
e.g., for Postgres.app:
export PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
This might be useful: http://blog.ringerc.id.au/2012/09/postgresql-packaging-on-mac-os-x-is-mess.html

Resources