Hosting on PostgreSQL 9.6 for windows 32 bit [duplicate] - postgresql

From many days i'm trying to set the hosting on my postgreSQL. I try many solution but no one works. The version of my postgres is 9.6 for windows 32 bit with pgAdmin 4.
I've set in my pg_hba.conf with many type of option but non one work. Now it looks like this.
# IPv4 local connections:
host all all 127.0.0.1/32 #authmethodhost#
host all all 0.0.0.0/0 #authmethodhost#
# IPv6 local connections:
host all all ::1/128 #authmethodhost#
I've tried md5, trust.
thepostgresql.conf is already set like:
listen_addresses = '*'
I don't know how I can obtain the postgresql hosting
(the server work right in local host, the port is right set, the driver is installed).
This is the error message:
FATAL: no entry in pg_hba.conf for the guest "MY.IP.AD.DRS",
user "myadmin", "mydatabase" database, SSL is not enabled
Thanks.

Related

Error message with pg_dump and PostgreSQL 14

We use PostgreSQL for our database of Speedy Net. I had a production server with PostgreSQL 13, and I backed up my database with the following command:
pg_dump -U postgres -h localhost "speedy_net" | gzip > <file_name>.sql.gz
It worked with PostgreSQL 13, but recently I upgraded my server to Ubuntu 22.04.1 LTS and PostgreSQL 14. I loaded the database from SQL and everything works properly, but now I can't backup the database - I get the following error message:
pg_dump: error: connection to server at "localhost" (::1), port 5432 failed: fe_sendauth: no password supplied
Now, something has changed in the configuration file from PostgreSQL 13 to 14. In PostgreSQL 13, the file /etc/postgresql/13/main/pg_hba.conf was:
# Database administrative login by Unix domain socket
local all postgres peer
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all peer
host replication all 127.0.0.1/32 md5
host replication all ::1/128 md5
And in PostgreSQL 14 the file /etc/postgresql/14/main/pg_hba.conf is:
# Database administrative login by Unix domain socket
local all postgres peer
local all speedy_net trust
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 scram-sha-256
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all peer
host replication all 127.0.0.1/32 scram-sha-256
host replication all ::1/128 scram-sha-256
Notice, the line local all speedy_net trust is new. Is this line causing problems? I had to add it because otherwise I couldn't load the database from SQL.
Do you know how I fix it so that backups will work? If I run the command pg_dump -U postgres -h localhost "speedy_net" manually I get prompted for password, but there is no password and it worked with PostgreSQL 13.
Maybe I need to change the password? How do I do it?
The line that is causing the problems in the new file is
host all all ::1/128 scram-sha-256
That requires you to supply a password. You have two choices:
Use a different authentication method. trust would allow you to login without a password (since you are using it with “localhost” in IPv4, why not with IPv6?). If you don't want that, certificate authentication would be an option.
Create a password file on the new machine. Since you forced password authentication on the old machine, that's probably what you used there.

authentication method 10 not supported PostgresSQL

Can anyone explain why I can't create new connection postgres in navicat? It is possible that the error comes from version of navicat and Postgres? the error says:
authentication method 10 not supported
I tried reinstalling my Postgres but it didn't work.
change the pg_hba.conf about flowing content:
# "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

Odoo 10 - Can't access Postgresql (9.5) via pgAdmin4 even with pg_hba.conf changes

Need access to the Odoo postgresql DB (via pgAdmin 4). Even with the changes made to pg_hba.conf it won't connect.
# Database administrative login by Unix domain socket
local all postgres peer
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all [Our Networks IP]/32 md5
host postgres odoo [Our Networks IP]/32 trust
host SLWK_PRE-PROD_DB odoo [Our Networks IP]/32 md5
# IPv6 local connections:
host all all ::1/128 md5
Is my format wrong or am I missing something else? I've tried connecting via bash as a super user and it won't let me query stuff either.
I've already tried editing the pg_hba.config with different settings but no avail.
When trying to connect via pgAdmin 4 the following error appears:
FATAL: no pg_hba.conf entry for host "[Our Networks IP]", user "odoo", database "postgres", SSL on
FATAL: no pg_hba.conf entry for host "[Our Networks IP]", user "odoo", database "postgres", SSL off
Probably, you need to restart PostgreSQL? You need to reload its configuration after making any changes to apply them.
The easiest way to do it is to restart PostgreSQL service:
service postgresql restart
You can also use pg_ctl:
sudo su postgres
pg_ctl reload
Or you can do inside PostgreSQL itself:
psql -U postgres
postgres=> SELECT pg_reload_conf();
Solved the issue by putting the AWS EC2 instance IP in the pg_hba.conf in the Unix-domain socket fields. Was putting my configuration in the TCP/IP part of the pg_hba.conf.

Access postgresql remotely with pgadmin

In postgresql.conf I have:
listen_addresses = "*"
My pg_hba.conf looks like:
local all postgres md5
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
#host all all myIPADDRESS md5
If I uncomment the last line
pgadmin says it cannot access and to make sure whether the port is accessible. I have flushed the iptables to have no rules, so the firewall is not stopping it.
local access to the database from my scripts is not working
With the last line commented:
pgadmin says that no pg_hba.con entry for my IP address
I am able to access the database locally on the server from my scripts
What am I missing to make the configuration right?
Thanks.
Looking at this post. After adding to pg_hba.conf:
host all all ::/0 trust
host all all my.ipv4.IP/32 trust
It works now.
Not sure if order is important in pg_hba.conf but, I put mine at top and also tried with and without IP and both worked.
Had same problem with psql via command line connecting and pgAdmin not connecting on RDS with AWS. I did have my RDS set to Publicly Accessible. I made sure my ACL and security groups were wide open and still problem so, I did the following:
sudo find . -name *.conf
then sudo nano ./data/pg_hba.conf
then added to top of directives in pg_hba.conf file host all all 0.0.0.0/0 md5
and pgAdmin automatically logged me in.
This also worked in pg_hba.conf file
host all all md5 without any IP address and this also worked with my IP address host all all <myip>/32 md5
As a side note, my RDS was in my default VPC. I had an identical RDS instance in my non-default VPC with identical security group, ACL and security group settings to my default VPC and I could not get it to work. Not sure why but, that's for another day.

Can't connect to postgreSQL in VM (Ubuntu): Access to database denied

I use a Windows 10 machine with Virtualbox 5.0.16 in which Ubuntu 15.10 is running. The network adapter is a Bridged one with the name set to Intel(R) Dual Band Wireless-AS 3165. The promiscuous-Mode is set to allow all VMs and the host and the underlying checkbox is checked (cable connected).
In this Ubuntu, I run a PostgreSQL 9.4.5 instance in which I configured both the postgresql.conf and pg_hba.conf files.
In the postgresql.conf file, I have well set this line:
listen_addresses = '*'
And in the pg_hba.conf, I have following lines at the bottom:
# TYPE DATABASE USER ADDRESS METHOD
# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all 0.0.0.0/0 md5
host all all ::1/128 md5
host all all ::/0 md5
host all all 192.168.1.13 md5
host all all 0.0.0.0/0 md5
Currently, the ip address of my host machine is (ipconfig command and wireless) 192.168.1.13 and the guest machine is (ifconfig command) 192.168.1.4
When using pgadmin from the host machine to connect to the guest machine, I get following message: FATAL: no pg_hba.conf entry for host "192.168.1.13", user "postgres", database "postgres", SSL off
I tried to connect to my host to guest via ssh but I get a "Network error: Connection refused" message. Maybe this is a key insight of my issue?
The ping works in both directions.
Thanks to #DanielVérité.
The command show hba_file showed me the pg_hba I was actually editing was not the right one. I edited the one in /etc/postgresql/9.4/main folder while the one used by postgreSQL is /opt/PostgreSQL/9.4/data