Go to your PostgreSQL configuration and edit file pg_hba.conf:
sudo vim /etc/postgresql/9.3/main/pg_hba.conf
Then change this line:
Database administrative login by Unix domain socket
local all postgres md5
Database administrative login by Unix domain socket
local all postgres md5
to:
Database administrative login by Unix domain socket
local all postgres peer
Database administrative login by Unix domain socket
local all postgres peer
then RestartThen restart the PostgreSQL service via SUDOthe 'sudo' command then. Then
psql -U postgres
You will be now entered and will see the PostgresqlPostgreSQL terminal.
Then enter
\password
\password
And enter the new password for the PostgreSQL default user. After successfully changing the password again, go to the pg_hba.conf and revert the change to "md5".
Now you will be logged in as.
psql -U postgres
psql -U postgres
with your new password.