Skip to content

Instantly share code, notes, and snippets.

@gurkanakdeniz
Created October 13, 2018 20:05
Show Gist options
  • Save gurkanakdeniz/be65dfa8ee3e2ed1f9ca065d2d104364 to your computer and use it in GitHub Desktop.
Save gurkanakdeniz/be65dfa8ee3e2ed1f9ca065d2d104364 to your computer and use it in GitHub Desktop.
Postgresql install and remote connection
yüklemek icin:
sudo apt-get install postgresql postgresql-contrib
giris icin: (postgres adında default kullanıcı ile geliyor pass yok)
sudo -i -u postgres
psql
yeni kullanici:
createuser --interactive
Enter name of role to add: kullanici_ismi
Shall the new role be a superuser? (y/n) y
kullanici sifre atama:
sudo -u user_name psql db_name
ALTER USER user_name WITH PASSWORD 'new_password';
postgresql uzaktan baglanti:
1) /etc/postgresql/versionNo/main/postgresql.conf (ubuntu icin)
listen_addresses = '*'
2) /etc/postgresql/versionNo/main/pg_hba.conf
en alt satira:
-- trust -- paratametresi ile yaparsan pg kullanicisinin sifresi gerekmez
-- md5 -- parametresi ile yaparsan pg kullanicisinin sifresi gerekir
0. yontem : (bu sekilde sadece local network icin acilmis oluyor)
host all all 192.168.1.0/24 md5
1. yontem :
host all all "senin ip adresin" trust
2. yontem :
host all all all trust
3. yontem :
host all all "senin ip adresin" md5
4. yontem :
host all all all md5
3)
sudo systemctl restart postgresql.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment