installed PostgreSQL on Linux. The problem is that I can’t use the PSQL command, because requires a password. When installing, it seems the password did not need. I tried to enter the password from the server, did not work.
Tried to remove PostgreSQL from the server, did not work because requires a password.
What could be the problem?
Answer 1, Authority 100%
- in the file
pg_hba.conf
change the authentication method ontrust
- Restart postgreSQL
- Run
PSQL
and executealter user postgres password 'newpass';
- Return the previous authentication methods in the
pg_hba.conf file
- Restart postgreSQL
service
again
Answer 2, Authority 50%
There are two options:
-
logged under the “administrator”:
Sudo -u Postgres PSQL Postgres
will ask the password from the current user.
-
Create a new user and database:
sudo -u postgres CreateUser -L name sudo -u postgres crasedb -o name_name_Base name PSQL_name_Base
will ask the password from the current user.
Name
– the name of the current user in the system.
If it says that the password is not correct:
su root
User Password Root
Servers.
su postgres
And then one of the examples is higher, only without sudo -u postgres
.