Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What is your platform? If it is Debian then it is as simple as this to install PostgreSQL and set up a PostgreSQL root user with the same username as your UNIX username (this to avoid having to modify pg_hba and and also not having to specify user when connecting to PostgreSQL).

  sudo apt-get install postgresql
  sudo -u postgres createuser -s `whoami`
After this you an just create a database and connect to it with:

  createdb my_db
  psql my_db


Usually Ubuntu, so I will have a look at this. However when running an application say in PHP its going to be running under the Apache user. How do I go about configuring that?


I see, I usually do ruby development so the webserver is then usually running as my user on my development machine (obviously that is not the case in production).

In your case, then I would just change pg_hba to allow all local connections as shown by moe above. (I would not set any password though since that is normally not useful or necessary for local development).


     sudo -u postgres createuser -s `whoami`
Won't this create another user named "postgres"?

EDIT: No it won't:

     Ophelia ~ $ sudo -u postgres whoami
     postgres
     Ophelia ~ $ sudo -u postgres echo `whoami`
     rich
That seems straight out of The Unix Hater's Handbook.


The idea that commandline expansions like $VAR, `backtick` and wild*cards are done by the shell, before the program is invoked, is not particularly esoteric is it?


No. But, I had to think about it.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: