Created
December 21, 2023 15:25
-
-
Save Lazzlo2096/528743aacf7e020d903563936fe41e05 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# как зайти в БД postgres на wsl из pg_admin на windows хосте : | |
# 1. узнаём ip wsl: | |
$ ifconfig | |
inet 172.25.225.20 | |
# или | |
PS> wsl hostname -I | |
172.25.225.20 | |
## или | |
#$ ipconfig.exe # это не то | |
#IPv4-адрес. . . . . . . . . . . . : 172.25.224.1 | |
## https://dba.stackexchange.com/questions/83984/connect-to-postgresql-server-fatal-no-pg-hba-conf-entry-for-host | |
# 2.1 добавляем эти строки: | |
$ sudo vim /etc/postgresql/14/main/postgresql.conf | |
``` | |
listen_addresses = '*' | |
``` | |
# 2.2 добавляем эти строки: | |
$ sudo vim /etc/postgresql/14/main/pg_hba.conf | |
``` | |
# TYPE DATABASE USER CIDR-ADDRESS METHOD | |
host all all 172.25.225.20/0 scram-sha-256 | |
``` | |
# 2.3 перезапускаем постгрес: | |
``` | |
service postgresql restart | |
``` | |
# 3. теперь мы можем на windows-хосте коннектиться к postgres БД |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment