1 Answer
You've locked yourself out, because you enabled md5 authentication for database user postgres without setting a password for the database user postgres.
Open the filevim /etc/postgresql/10/main/pg_hba.conf
Add a new line to the top of pg_hba.conf:
local postgres postgres peer
Then restart/reload PostgreSQL:
/etc/init.d/postgresql reload\
and run:
sudo -u postgres psql
From the resulting prompt:
ALTER USER postgres PASSWORD 'my_postgres_password';
Remove the line you added to pg_hba.conf and restart Pg again. You can now use the password you set above to connect to
PostgreSQL as the postgres user.
Your Answer
x