pgAdmin III : No servers showing up - postgresql

I've followed many online tutorials on how to install pgAdmin correctly, I've installed and uninstalled it multiple times but whenever install it. It shows Server Groups without any servers in it.
Then when I try and register a new server using localhost for both name and host I get this error:
server doesn't listen
Searched for days trying to find a solution for this, any ideas?

Happened with me as well, when I started pgadmin3 for the first time, I was expecting it to ask for the password which I provided during but it didnt ask and then didnt display any servers.
Anyways, you can create a server yourself.
If your server is on the same machine,
provide a name: test
provide server: localhost
provide a port number : 5432 (default port)
provider a username: postgres (default user, you can change later in login roles)
password: provide something
Restart if required, and it will then show you a
database with postgres (default db),
tablespace, and login roles under your server, and you should be good to go .

First Create a Server with the following credential-
Host Name/address : localhost
Port : 5432
Maintenance database : postgres
Username : postgres
Password : *Your_Password*
Note : Before Creating the Server first start the postgresql server

Reinstalled program and saved it to directory C:\ instead of C:\program_Files

When I did this invalid password message appeared. So I had to change postgres user password:
In the terminal window:
Switch to the postgres account on the server by typing:
sudo -i -u postgres
Now I can access a Postgres prompt immediately by:
psql
Change the postgres user password:
ALTER USER postgres WITH PASSWORD 'newpass';

Related

postgres password error : Please enter the password for the user 'postgres' to connect the server - "PostgreSQL 13"

I having issue connection to postgres, I am installing at windows 10 via the EDB installer (version 13.2) . I follow all the steps it install fine however when I try to enter the default database using pgadmin it I always get stuck at this error :
Please enter the password for the user 'postgres' to connect the server - "PostgreSQL 13"
during instalation postgres ask me to specify my master Password. then when instalation finish and I open my pgadmin it again ask me to enter the master password so I did and I was able to successfully login but when I try to open the default database that when it ask me to enter password for posgres user , I try to use the my master password but it did not work
I installed and uninstall it many time with no success. I also tried this solution so I did change the Method in pg_hba.config from scram-sha-256 to trust however when I executed this command psql -U postgres it again asked me for the password
any help please
You made the same mistake I did: you installed pgAdmin4 without installing postGreSQL server itself. The server installation does indeed set the Master password and the postgres user password at the same time, as the commenters were trying to point out. JUST installing pgAdmin sets a master password for the Admin environment. I don't really understand how there's not a more useful error for trying to connect to a server instance that doesn't actually exist, but here we are.
try it. it resolves for me
step 1
step2

How to run postgresql from Command line and know available Databases in Windows

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.

SSH tunnel to postgres from Tableau desktop - invalid username and password

I am trying to connect Tableau to a postgres DB using a SSH tunnel. The steps I have taken are
Install postgres drivers (32 bit) on my desktop
Create the tunnel in putty (tunnel L5432 127.0.0.1:5432) and open up the terminal
From this session I can run Postgres from the command line psql -d mydb -U myuser
However, when trying to connect using Tableau I get the error message "Invalid username and Password"
If I try to connect to a DB that doesn't exists I get the same error message "Invalid username and Password"
I have also created a psql user with superuser privileges but no success. Note that the username for the ssh tunnel and the psql db are different.
I have seen a number of posts on the forum with no solution.
Can anyone help? Thanks.
Roger
I met with the same question, with slight difference, I didn't use PuTTY but instead using Cygwin Autossh.
The answer is that two tunnels need to be built, first an ssh tunnel from local host to server, and then from the server port to the database port. A possible solution is to set up ssh tunnel like this:
5432:localhost:5432 username#hostserverdomain
The first 5432 is the local port(Tableau or PGAdmin), the second localhost actually refers to the server(cuz once log in localhost means the server itself), the second 5432 is the database on the server. And in order to get access to the database, one has to log in the server.
The above is just the syntax to connect thru two tunnels using ssh.
At first I didn't understand what Roger means by two tunnels, and then I look into the underlying methodology and finally got all the setup work done. Thanks Roger!

Openbravo postgres installation

I am trying to get a copy of Openbravo on Ubuntu for development. I am following the official guide and I get stuck by a Postgres error.
I have successfully downloaded the source code through the mercurial commands. ant setup also worked for me.
When I run the Wizard I write this information.
The problem comes when I run ant install.source:
BUILD FAILED
/home/User/openbravo/build.xml:734: The following error occurred while executing this line:
/home/User/openbravo/src-db/database/build-create.xml:50: The following error occurred while executing this line:
/home/marcguilera/openbravo/src-db/database/build-create.xml:77: org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:136)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:125)
at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
The stacktrace is longer.
I)
First we need to change the PostgreSQL postgres user password else we will not be able to access the server. As the “postgres” Linux user, we will execute the psql commands below.
In a terminal, type:
$ sudo -u postgres psql postgres
Set a password for the "postgres" database role using the command:
\password postgres
II) Create database
To create the first database, which we will call leo, simply type:
sudo -u postgres createdb leo
III) install Server Instrumentation (for PgAdmin) for Postgresql 9.1
PgAdmin requires the installation of an add-on for full functionality. The "adminpack" addon, which it calls Server Instrumentation, is part of postgresql-contrib, so you must install that package.
Then to activate the extension,
For "Postgresql 9.1"+ install the adminpack "extension" in the "postgres" database:
$ sudo -u postgres psql
then
CREATE EXTENSION adminpack;
IV) Using pgAdmin III GUI
To get an idea of what PostgreSQL can do, you may start by firing up a graphical client. In a terminal type :
pgadmin3
You will be presented with the pgAdmin III interface.
* Click on the "Add a connection to a server" button (top left).
In the new dialog:
enter the address **127.0.0.1**
host is **jdbc:postgresql://localhost:5432/postgres**
the default database ("leo" in the example above)
your username ("postgres") and your password.
One more step is required in order to allow pgAdmin III to connect to the server, and that is to edit pg_hba.conf file and change the authentication method from peer to md5 (Will not work if you have not set the password.):
sudo nano /etc/postgresql/9.1/main/pg_hba.conf
and change the line
# Database administrative login by Unix domain socket
local all postgres peer
to
# Database administrative login by Unix domain socket
local all postgres md5
Now you should reload the server configuration changes and connect pgAdmin III to your PostgreSQL database server.
sudo /etc/init.d/postgresql reload
With this GUI you may start creating and managing databases, query the database, execute SQl etc.
https://help.ubuntu.com/community/PostgreSQL
v) Run openbravo with postgres
Just adjust the db name, user name and the passwords.
Hope that helps.

pgadmin gives me the error: no password supplied

I've installed postgresql 9.2 on linux (kubuntu) and the last version of pgadmin3, but when I connect them I have this error:
An error has occurred:
Error connecting to the server: fe_sendauth: no password supplied
What can I do?
I have also configured tomcat for my web application in java. In fact, postgresql was working before trying my application.
Change the password for role postgres:
sudo -u postgres psql postgres
alter user postgres with password 'postgres';
Try connect using "postgres" for both username and password.
Refer to: How to change PostgreSQL user password
Whether a password is required depends on your settings in pg_hba.conf. And there are different ways you can connect - different settings in pg_hba.conf may apply.
I quote the help shipped with pgAdmin 3 for the "Host" field in the connection ("server") settings:
The host is the IP address of the machine to contact, or the fully
qualified domain name. On Unix based systems, the address field may be
left blank to use the default PostgreSQL Unix Domain Socket on the
local machine, or be set to an alternate path containing a PostgreSQL
socket. If a path is entered, it must begin with a “/”. The port
number may also be specified.
If you connect via Unix socket the rules for "local" apply.
Whereas when connecting via TCP/IP "host" (or "hostssl") rules applies.
If you have a line like this at the top your pg_hba.conf file:
local all all peer
or:
local all all ident
.. then you can connect locally without password if your system user is "postgres" and your database user is "postgres", too.
I realize this is question is years old, but I ran into this same problem today and have a solution that uses trust in a limited but useful way.
As in many development shops, when the devs need a QA postgres password, they just yell it, message it, email it, write it on their foreheads, etc. And I'm like, "This is really bad. I need to figure out a way to use PKI here." We also use pgAdmin3.
First, add a line like this to your pg_hba.conf, where dev represents the user for the developers in your shop:
host all dev 127.0.0.1/32 trust
Drop the developers' public key in their authorized_keys folder on the database server. Now have them ssh into the server with the -L flag with a command similar to the following:
ssh -i ~/.ssh/id_rsa -L5432:127.0.0.1:5432 -vvv 101.102.103.104
This allows one to use the postgres port as if it were localhost. Of course, replace the key, server and make sure to map to an open port locally (if you have a local postgres running, it's probably bound to 5432). I use a pretty verbose flag so I can easily troubleshoot any ssh issues.
Open another terminal and issue this command:
psql -h 127.0.0.1 -U dev -p 5432
You should have access to the database and never be prompted for a password, which I think is great because otherwise, the devs will just waive the password around with little regard to security, passing it out like Halloween candy.
As of now, PgAdmin3 will still prompt you for a password, even though -- plain as day -- you do not need it. But other postgres GUIs will not. Try Postico. It's in beta but works great.
I hope this answer helps anyone like me who would rather use PKI for postgres auth rather than sharing passwords willy-nilly.
Met this problem recently.
If you're using PostgreSQL on local machine, and psql works well without logging needed, try pgadmin3's menu File - Add Server - Properties tab, fill in Name field for this connection, leave Host field and Password field empty, and click ok.
from pgadmin docs
On Unix based systems, the address field may be left blank to use the
default PostgreSQL Unix Domain Socket on the local machine, or be set
to an alternate path containing a PostgreSQL socket. If a path is
entered, it must begin with a “/”.
Worked on Debian testing (pgadmin3 1.22, PostgreSQL 11), without touching pg_hba.conf.
For me, I run pg_ctl -D /usr/local/var/postgres start, start the server, then everything is OK, it will pop out the connection host port.