Home linux linux. PostgreSQL

linux. PostgreSQL




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%

  1. in the file pg_hba.conf change the authentication method on trust
  2. Restart postgreSQL
  3. service

  4. Run PSQL and execute alter user postgres password 'newpass';
  5. Return the previous authentication methods in the pg_hba.conf file
  6. Restart postgreSQL
  7. again

Answer 2, Authority 50%

There are two options:

  1. logged under the “administrator”:

    Sudo -u Postgres PSQL Postgres

    will ask the password from the current user.

  2. Create a new user and database:

    sudo -u postgres CreateUser -L name
    sudo -u postgres crasedb -o name_name_Base name

    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 .

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions