I've installed postgresql 14 and pgadmin4 on Ubuntu 20.04. I set a password with sudo passwd postgres and restarted postgresql I've modified the METHOD settings in /etc/postgresql/14/main/pg_hba.conf to be trust. But pgadmin4 refuses to connect with this message:
This used to be all it took to get pgadmin4 to connect.
Is there something new in Postgresql 14 that has to be done?
Thank you, I was going crazy trying to resolve this issue for the last 3 days until I hit this post.
I recently installed PostgreSQL 14 on Ubuntu 20.04 and was trying pgAdmin 4 v. 6.7 and was not able to even create a server without having an INTERNAL SERVER ERROR message. The issue was that when installing PostgreSQL I simply used the same Linux root user password and did not specify a password for the postgres user as you mentioned in the line:
psql -c "ALTER USER postgres WITH PASSWORD 'secure_password_here';"
Thank you
Related
First of all - I'm not an expert (to say the least).
I want to set up a PostgreSQL database on my Raspberry Pi 4, with Ubuntu Desktop 22.04 LTS and pgAdmin4, but I got stuck.
After running pgadmin in Python Virtual Environment and going to 127.0.0.1:5050, login page appears, all seems fine, until I try to set up a new server. After providing server name and address alert appears: "Unable to connect to PostgreSQL server: SCRAM authentication requires libpq version 10 or above"
Modifying password-encryption and METHOD in pg_hba.conf and postgresql.conf to md5 did not help.
Postgres 14, pgAdmin 4 v 6.10, libpq-dev is already the newest version (14.4-1.pgdg22.04+1).
Any suggestions?
I have tried many combinations of changing passwords, configs and restarting. Here's what worked:
I have removed libpq.so from usr/lib/aarch64-linux-gnu (libpq.so.5 and libpq.so.5.14 are left alone)
Changed all METHODs in pg_hba.conf to trust & restart postgres
Changed password-encryption in postgresql.conf to md5 & restart postgres
Reset password for user postgres (which might have been redundant due to "method/trust") & restart postgres
...and it works.
Thank you!
I am trying to remove postgresql completely from my Mac M1 and then install postgres 13.
There were postgres 14, postgres 11 and postgres 13 installed (simultaneously) on my computer. Due to versions conflict I decided to remove all my postgreses and install version 13 de novo.
To uninstall postgres completely, I followed these recommendations: https://blog.testdouble.com/posts/2021-01-28-how-to-completely-uninstall-homebrew-postgres/
Now I have:
% postgres --version
zsh: command not found: postgres
% which postgresql
postgresql not found
% psql testdb
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory == NO DATABASES
%brew list also shows no postgres installed
but when I do
% psql --version
I see:
psql (PostgreSQL) 14.1
and
% which psql
/opt/homebrew/opt/libpq/bin/psql
So, I have front-end PostgreSQL 14 until now.
Is it normal that psql was not uninstalled with postgres server?
Of course some postgres files also remain in cache, as well as some Docker postgres images.
Should I remove postgresql14.1 client manually? Here I read that in such case after re-installation I can expect Error.
Or, in general: am I missing something that will prevent my computer from correct installing and running Postgres 13 locally and outside of Docker?
Thank you so much in advance for clarification.
Yes, Postgres client (psql) and PostgreSQL server are two separate software. Quite often you need psql in your workstation even if server is running somewhere else.
But if you don't need to connect any PostgreSQL server anymore from your workstation, you can remove psql. No harm done. And it is always easy to re-install if needed.
I am new to PostgreSQL and before I start learning got stuck in the password;
I have forgotten my password to PostgresSQL 13 path when I use pdAdmin tool.
I use mac. Apologies for basic questions.
I went through multiple articles, videos but I am unable to through different steps.
Steps I did:
Downloaded PostgreSQL 13, logged into pgAdmin, forgot password to PostgreSQL 13 db
Found the "pg_hba.conf" and edited the method from "md5" to "trust"
Steps I am unable to proceed and stuck:
Restart the postgresql service (where and how do I do this? via launching Terminal?)
Start psql session as postgres (how to launch? I searched the psql via search. When I entered "psql -U postgres", its asking for "Database" and "Port (5432)" and "Username". I am unaware to find these"
This is where I am unable to go to next step to use ALTER USER command to reset.
I went through this but when I enter the command "sudo -u user_name psql db_name", its asking for all information above which I don't have knowledge yet. Same as above points where I am getting stuck.
Many thanks in advance.
If you installed Postgres using brew (That's most common case)..
To access postgres
# psql postgres
postgres is the database name, and after this you will be logged into psql and will see postgres db. You can switch to your database as -
\c <your-db-name-here>
To start/stop/restart
brew services start postgresql
brew services stop postgresql
brew services restart postgresql
If you did not install using brew and want to do so -
brew install postgres
Os - ubuntu 18.04 (bionic)
I have installed postgresql 10 some time ago, and today i install a new version, 12.
I don't mind to throw all the previous data, so i tried to do pg_ctl stop for the old server. I am not able to execute the pg_ctl stop for the old server, because the command not found.
I found where postgres is installed, under /var/lib/postgres and it has two folders, one is 10 and the other is 12. I tried to call pg_ctl from 10/main but it does not appear also there. there is no bin folder there as well.
When I type psql under the postgres user, i get this info:
psql (12.2 (Ubuntu 12.2-2.pgdg18.04+1), server 10.12 (Ubuntu 10.12-0ubuntu0.18.04.1))
I have search for hours in the docs and on the web, but i didn't find info for that.
Can you help me understand what is going on in my machine?
Edit: pg_lsclusters output:
Ver Cluster Port Status Owner Data directory Log file
10 main 5432 online postgres /var/lib/postgresql/10/main /var/log/postgresql/postgresql-10-main.log
12 main 5433 online postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
also, i can no longer connect to the new port. I have try to connect to port 5433 with postgres user and my password ( I have changed the pg_hba.conf row to authenticate with md5), but it didn't work.
I have installed the community edition of the Openproject in the ubuntu desktop.
Openproject automatically installed PostgreSql in the ubuntu system.
I have installed the pgadmin software in my ubuntu system to connect to postgresql.
I want to know how to connect to the database and generate the report
Thanks in advance for your valuable answers
In Ubuntu environment you can open terminal and switch into postgres user and create new DB user with superuser permissions:
sudo su - postgres
createuser --interactive --pwprompt
After user created you can use it credentials to connect to DB using any cli/gui tool.
I recommend DBeaver Community Edition as PostgreSQL GUI tool.