View Single Post
  #1   (View Single Post)  
Old 10th January 2013
ershiba ershiba is offline
Loading, please wait...
 
Join Date: Dec 2012
Posts: 34
Default postgresql - log into psql without password problem

hi bsd members,

i got the following issue that somehow i think kinda weird,

i pkg_add postgresql-server
Code:
$ sudo su - _postgresql
$ /usr/local/bin/initdb -D /var/postgresql/data
// start the postgresql server
$ /usr/local/bin/postgres -D /var/postgresql/data

$ whoami
$ _postgresql
$ psql postgres
postgres=# create role pgoem login password 'pgoempasswod' createdb valid until 'infinity';

// restart openbsd
// i use pgAdmin III to connect postgresql
it asks for password when i use pgoem user to connect ( ok, this should be how things done )

// using putty, i log into OpenBSD using my OpenBSD username 'oem'
// then i tried the following
$ psql -U pgoem postgres
psql (9.1.4)
Type "help" for help.
postgres=> CREATE DATABASE testing;
CREATE DATABASE
i use pgAdmin III to check, a database "testing" was created with owner set to pgoem,

but how could pgoem without using password, able to access postgres database and able to allow create a database? isn't it weird?
Reply With Quote