Re: starting postgres/psql - Mailing list pgsql-novice
From | Andrew Kelly |
---|---|
Subject | Re: starting postgres/psql |
Date | |
Msg-id | 1083222169.4133.52.camel@hermes.at.home Whole thread Raw |
In response to | starting postgres/psql (Robert Morgan <robert_@ihug.co.nz>) |
List | pgsql-novice |
Hi Bob, On Wed, 2004-04-28 at 22:12, Robert Morgan wrote: > Back again,I still cant access the dbms I have created the user postgres > and started postgres. > > [root@localhost bob]# su postgres Be careful with your execution of su, Bob. The command you want is 'su - postgres' and not just 'su postgres'. The way you've done it (here and in subsequent posts) does in fact make you the postgres user, but without the '-' you do not get the environment of the postgres user. man su will help. > bash-2.05b$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l > logfile start > /usr/local/pgsql/bin/pg_ctl: line 341: logfile: Permission denied > postmaster successfully started That command is correct syntactically, but I'm not sure you're understanding what's going on when you issue it. First of all, the absolute path to the executable is necessary because you didn't use the '-' when you su'd to postgres, so /usr/local/pgsql/bin is not be in your PATH. Had you done 'su - postgres' you could simply have done pg_ctl -D /usr/local/pgsql/data (or ./pg_ctl if you are already in the /usr/local/pgsql/bin dir.) pg_ctl is a utility for starting, stopping, or restarting postmaster(1), the PostgreSQL back-end server, or displaying the status of a running postmaster. [That's the first line in the pg_ctl man page, by the way.] The 'start' at the end of your command string is what you are telling pg_ctl you want it to do, and '-D /usr/local/pgsql/data' is what it is that you want pg_ctl to start. And it all worked as you see: "postmaster successfully started". But you've also told pg_ctl with the '-l' switch that the postmaster process should log to a file and you've told it the file should be called logfile. You've said as user postmaster "create a file called 'logfile' in this directory and write to it". Clearly the postgres user does not have permission to write to the directory from which you issued your start command. (And for the sake of clarity, you might want to name your log file something other than logfile. > this brings me to the bash-2. 05b$ prompt where I tried > > bash-2.05b$ psql -d template1 > bash: psql: command not found > bash-2.05b$ No, of course it wouldn't be. The command psql is in /usr/local/pgsql/bin which is in the PATH of user postgres, but *not* in the PATH of the user root. You as user root said 'su postgres' which means "I wish to become postres, but I want to keep my own environment". Had you instead done 'su - postgres' the command above would have succeeded for you. > > so how do I get access? > An honest answer? Read the man pages for 'su' and 'bash', and then for 'postmaster', 'posgres' and 'pg_ctl'. The problems you're having here (and in subsequent posts) are, well, trivial. I don't mean that to be insulting. I mean that in the true sense of the word. You're getting caught on little things like permissions issues and the correct execution of basic shell commands, all of which could be cleared up with 10 minutes of man page reading. I might be misremembering here and forgive me if I am, but something I read in one of your other posts shows that you are also unfamiliar with what mysql is, so I'm rather curious about something. What is it you intend or hope to do with postgres once you've got a functioning deployment in place? You seem somewhat unsure in a shell; are you familiar with SQL? Andy
pgsql-novice by date: