I just did a fresh installation of postgres 13 on my windows 10 64 bit and when I open the pgadmin 4 there are not servers listed on the servers list on left handside. When I try to add a server I get Unable to connect to server: FATAL: role "postgres" does not exist
the credentials I am using here are the credentials I entered while installing postgres but I have tried a bunch of other creds as well like postgres and blank, postgres and postgres but the behavior is same.
In my pg_hba.conf file the value of method is already set to trust instead of md5 so I have not made any changes to that file. I have tried restarting the postgres service as well but that didnt help.
Any help would be appreciated.
Related
I have a ThingsBoard Professional Edition setup using AWS EC2 instance. The database is PostgreSQL-12. I tend to get the following error: FATAL: password authentication failed for user "postgres" FATAL: password authentication failed for user "postgres" when trying to log into the remote database server on pgAdmin4.
Here is a screenshot of the error shown when attempting to log in to server created on pgAdmin4.
Here is how I configured the remote database server (where Host name/address is the Public IPv4 of my EC2 instance).
In postgresql.conf, I have replaced the line listen_address='127.0.0.1' with listen_addresses='*'.
In pg_hba.conf, I added host all all 0.0.0.0/0 md5.
Here is a screenshot of my pg_hba.conf file:
I have also set the password for the user 'postgres' using the psql command #\password.
Here is what is shown in thingboard.log when I run the command:
cat /var/log/thingsboard/thingsboard.log | grep ERROR
Partial screenshot of /var/log/postgresql/postgresql-12-main.log shows the following:
I constantly have to use #ALTER USER postgres PASSWORD ‘<password>’; to be able to overcome this error but the error tends to return when I restart my local Windows machine.
That must be done by some software other than PostgreSQL.
Configure logging by setting log_statement = 'ddl' in postgresql.conf and restarting the database. Then you can more easily figure out when and by which software your password gets changed.
Additionally, configure pg_hba.conf to not allow passwordless connections from anywhere, then change the password. You may see some component start to complain - that component may be at fault.
I have PostgreSQL 12 installed and using Windows 10. My goal is to connect to postgre via php, because it didn't work I tried with plsql but it didn't work either, i always get (with both plsql and php using PDO):
FATAL: password authentication failed for user "postgres"
Connection via plsql in cmd
However, when trying via pgAdmin4, I can connect and access my databases. I first use my root password then sometime my postgres user one, so I'm sure my password works.
Here is my pg_hba.conf file:
pg_hba.conf file
I have a set password for postgres which was set vua pgAdmin4.
I don't understand why it would work one way and not the other, can anyone help me?
So after trying several things, I found that plsql and php error was due to the wrong port being adressed.
By default 5432 is used, but for some reason my configuration was using 5433.
You can find this information in pgAdmin4 by opening PostgreSQL 12 properties, and then checking in connection tab.
To change the used port in plsql I used:
psql -U postgres -p 5433
Change 5433 by your configured port if you have same issue, you also need to specify the port if using php's PDO.
I have installed postgresql database and pgadmin4 on my fedora machine.
after starting the postgresql service and trying to connect to postgresql server
from pgadmin4
i am getting this error
Unable to connect to server:
FATAL: Ident authentication failed for user "postgres".
how should i fix this?
Did you create the "postgres" user while installing? You may be using wrong credentials, if you have forgotten the password, please change the pg_hba.conf (then reload or restart postgresql server) to allow all the connections from local without credentials, then change the password for postgres (again reload or restart postgresql) user. Change the pg_hba.conf to use credentials and try logging in.
I am very new to postgreSQL and struggling to create a connection in my Eclipese.
Here is what I have done till now:
Installed DBeaver plugin for eclipse from marketplace.
Installed PostgreSQL version 10 from https://www.postgresql.org/download/windows/
Now I attempt to create a connection in Eclipse but I get an error "FATAL: password authentication failed for user "testuser"
I checked through a similar thread (
Getting authentication failed error with postgresql from command line
) but could not resolve the issue.
Could you please help.
To connect the PostgreSQL via Command line you have to install a PostgreSQL provided tool called "psql" if not installed already.
Then use the below command to connect to PostgreSQL database.
psql -h localhost -p 5432 -U postgres
Explanation:
localhost: is the hostname of machine where PostgreSQL is installed.
5432 : is the default PostgreSQL port
postgres : is the username of to connect to DB
Solution for your issue:
FATAL: password authentication failed for user "testuser"
As error message specified, either user not exists on database or the password that you supplied to connect is incorrect. Re-verify your user and password, and try again.
All the best.
I have a postgresql demon on my virtual Linux box, and just installed pgAdmin III on the Windows machine. Now I'd like to configure the first connection.
What I did so far:
I edited /etc/postgresql/9.1/main/pg_hba.conf and added a line to make the demon accept connections from my Windows machine:
host all all 192.168.123.45/32 md5
I set a shell passphrase for the system user postgres (sudo passwd postgres)
Edit: this seems to be irrelevant
I copied /usr/share/postgresql/9.1/pg_service.conf.sample to /etc/postgresql-common/pg_service.conf and uncommented the sample service, giving me
[postgres]
dbname=postgres
user=postgres
Edit: this seems to be irrelevant
I put a line into /etc/environment to point to the pgservice.conf file:
PGSERVICEFILE=/etc/postgresql-common/pg_service.conf
(which works; when I duplicated the PuTTY session, it had this variable)
I restarted the database server after each change:
sudo /etc/init.d/postgresql restart
Finally, I restartet the Linux box,
The server seems to have restarted successfully:
[ ok ] Restarting PostgreSQL 9.1 database server: main.
However, when I try to connect to the service, pgAdmin III gives me an error message:
Error connecting to the server: definition of service "postgres" not found.
dmesg | grep postgres gives me a single line:
[ 18.054965] postgres (2242): /proc/2242/oom_adj is deprecated, please use /proc/2242/oom_score_adj instead.
I have no clue whether postgresql uses my pq_service.conf at all, or whatever else is the problem; any help is appreciated ...
Edit:
My original question, "How can I know whether postgresql uses my pg_service.conf file?", seems to be answered - it simply doesn't. I still can't connect; but now the question doesn't match the error messages anymore.
I removed the "Service" entry from my "New Server Registration" data. Now I get another error - something like "password authentication for user >>postgres<< failed". I'm quite sure the password is correct - I just set it ... and I tested it by commenting out my ssh key from the authorized_keys file.
I'd happily connect with my ssh key, but this seems to be difficult as well. With PuTTY, my key is taken from Pageant, and I'm logged in without any problem; pgAdmin talks about "SSH tunnelling", but I normally don't need tunnels for this local machine ...
I tried to create a tunnel anyway.
PuTTY session:
Source port is 5432
destination is my-vbox.host.name:5432
In pgAdmin, "SSH Tunnel":
Username postgres
using Identity file
Tunnel host localhost → error:
"SSH error: Could not connect to socket with error code 10051"
Tunnel host localhost:5432 → error:
"SSH error: Unable to resolve host: localhost:5432"
Tunnel host 127.0.0.1:5432 → error:
"SSH error: Unable to resolve host: 127.0.0.1:5432"
How the heck is this supposed to be configured?!
I finally managed to connect as db user tobias (I never had problems to connect locally, with psql).
# sudo -u postgres psql postgres
psql (9.1.9)
Type "help" for help.
postgres=# \du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------+-----------
postgres | Superuser, Create role, Create DB, Replication | {}
tobias | Superuser | {}
postgres=# ALTER USER tobias WITH PASSWORD 's3cr3t';
ALTER ROLE
After doing this, I could connect as tobias, using the password just set.
The "Maintenance DB" happens to be template1; I didn't try to change this.
For further reference - I activated log_connections in /etc/postgresql/9.1/main/postgresql.conf and watched the log:
sudo tail -f /var/log/postgresql/postgresql-9.1-main.log