Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am about to deploy my app to a vps for the first time, and running into some issues while configuring my DB.

After running the following commands...

# PostgreSQL
add-apt-repository ppa:pitti/postgresql
apt-get -y update
apt-get -y install postgresql libpq-dev

everything seemed to work fine until

sudo -u postgres psql

I was supposed to login to psql, but the command did not do anything (didn't return anything). I tried

su postgres

instead, and it got me to postgres@myaccount:/root$

and then I tried

sudo postgres psql

and it asked me for the password, but the root password did not work for this.

What's the right way of logging into postgres in this case, and how do I set up my database?

UPDATE: I tried the following,

root@max:~# su postgres
postgres@max:/root$ psql
bash: /usr/bin/psql: /usr/bin/perl: bad interpreter: permission denied
share|improve this question

migrated from stackoverflow.com Dec 3 '12 at 23:38

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 0 down vote accepted

I think psql is supposed to run as postgres user . You should not type 'sudo' .

root@myaccount:/root$ su postgres
postgres@myaccount:/root$ psql 
share|improve this answer
    
when I do psql create user, it gives me usr/bin/perl: bad interpreter: permission denied –  Maximus S Dec 2 '12 at 1:03
    
When you issue 'psql' command as a postgres user , it takes you to command prompt . There you should type : create user your_user with password 'password'; (notice the semicolon at the end of the sql command). In case the user is created successfully , you should see something like CREATE ROLE. –  Qumara otBurgas Dec 2 '12 at 1:09
    
check my update please –  Maximus S Dec 2 '12 at 1:15
1  
As 'postgres' , what does $ echo $PATH shows ? Is your perl package installed ? (on debian : apt-cache policy perl) –  Qumara otBurgas Dec 2 '12 at 1:19
    
Installing perl solved the problem! –  Maximus S Dec 2 '12 at 1:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.