Last active
June 4, 2024 12:04
-
-
Save ezhov-da/3731c03b4156960d64b16b5f618ddf64 to your computer and use it in GitHub Desktop.
postgres изменение пароля пользователя postgres
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Полезные ссылки: | |
1. http://profhelp.com.ua/articles/postgresql-%D0%BA%D0%B0%D0%BA-%D1%81%D0%B1%D1%80%D0%BE%D1%81%D0%B8%D1%82%D1%8C-%D0%BF%D0%B0%D1%80%D0%BE%D0%BB%D1%8C-%D1%81%D1%83%D0%BF%D0%B5%D1%80%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D1%82%D0%B5%D0%BB%D1%8F | |
2. https://stackoverflow.com/questions/37234940/centos-locate-command-doesnt-work | |
3. https://stackoverflow.com/questions/19674456/run-postgresql-queries-from-the-command-line | |
Может произойти так, что ты забыл пароль от пользователя postgres. | |
Но не беда, его можно восстановить, для этого: | |
1. Открой файл: pg_hba.conf | |
Не знаешь где он лежит? Воспользуйся командой: locate pg_hba.conf | |
Не работает команда? Установи ее командами: yum install mlocate и updatedb | |
2. Измени в файле строку: | |
local all postgres md5 | |
на | |
local all postgres trust | |
3. Перезапусти сервис: systemctl restart postgresql-9.3.service | |
4. Зайди в командную строку psql командой: psql -U postgres | |
5. Введи команду: alter user postgres with password 'newpasswod'; | |
6. Нажми "Enter" | |
7. Для выхода из командной строки нажми набери \q + Enter | |
8. Проверь, что теперь ты можешь авторизоваться в БД под пользователем postgres и с указанным тобою паролем | |
9. Все получилось? | |
Измени строку в файле снова на: local all postgres md5 | |
10. Перезапусти сервис: systemctl restart postgresql-9.3.service | |
11. Profit! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment