missymadi
asked on
How do I start a Postgres 9 database?
Experts,
How do I start a Postgres 9 database? I looked at their site and the command is postgres -D /usr/local/pgsql/data
But I get an error that postgres cannot be found. How do I verify what the state is of the database? What is the syntax?
Thanks, Missymadi
How do I start a Postgres 9 database? I looked at their site and the command is postgres -D /usr/local/pgsql/data
But I get an error that postgres cannot be found. How do I verify what the state is of the database? What is the syntax?
Thanks, Missymadi
you can also use:
as the postgres user.
to check the status use
to stop the database use:
Note, all of these are run as the postgres user. To start or stop the database as root use:
pg_ctl start
as the postgres user.
to check the status use
pg_ctl status
to stop the database use:
pg_ctl stop
Note, all of these are run as the postgres user. To start or stop the database as root use:
service postgresql [start | status | stop | restart]
ASKER
I used sudo service postgresql start and recieved " user is not in the sudoers file. This incident will be reported".
What password is it looking for?
What password is it looking for?
ASKER
I just read the last entry for postgres user.
I tried logging in as postgres but realized that I did not set a password for postgres....what password do I use for postgres? What is the syntax to log in as postgres? I used
su postgres
How do I give postgres a password? What is the syntax?
Thanks, Missymadi
I tried logging in as postgres but realized that I did not set a password for postgres....what password do I use for postgres? What is the syntax to log in as postgres? I used
su postgres
How do I give postgres a password? What is the syntax?
Thanks, Missymadi
log in as root and issue the "service postgresql start" command. If you do not have access or can't log in as root, then you will need to log into the postgres user (su - postgres) and issue the "pg_ctl start" command.
issuing a sudo command is a way for super users on a computer to run commands as root, without loging is as root. the password it is looking for the the root password, but you must be in the sudoers list to do it
issuing a sudo command is a way for super users on a computer to run commands as root, without loging is as root. the password it is looking for the the root password, but you must be in the sudoers list to do it
if you didn't give postgres a password, you will have to log in as root and change the password
su - root
passwd postgres
<follow the directions>
ASKER
I entered service postgresql start
postgresql: unrecognized service?
postgresql: unrecognized service?
in that case try changing the postgres users password...Log in as the postgres user, and then use the pg_ctl start command
ASKER
what am i doing wrong!
su postgres
pg_ctl start
bash: pg_ctl: command not found
su postgres
pg_ctl start
bash: pg_ctl: command not found
as the postgres user. Verify that your PATH variable is set to $PATH:/usr/local/pgsql/bin . The most important part of that is the /usr/local/pgsql/bin. Find where your binaries are installed(it should be fairly similar to that) to set the PATH variable use this
Again. Find the pgsql binaries, add them to your PATH variable and then issue the pg_ctl start command.
export PATH=$PATH:/usr/local/pgsql/bin:.
Again. Find the pgsql binaries, add them to your PATH variable and then issue the pg_ctl start command.
ASKER
Our setup is as follows
/usr/pgsql-9.0/bin
under bin there is clusterdb, createdb, createlang, createuser...... are these the binaries i'm looking for??
/usr/pgsql-9.0/bin
under bin there is clusterdb, createdb, createlang, createuser...... are these the binaries i'm looking for??
yes, in that folder there should be a file called pg_ctl. I am guessing you have not initialized the database yet, so that is the first thing you need to do. Run initdb in the /usr/pgsql-9.0/bin folder. after this runs, pg_ctl should be in that folder. Once it is there run pg_ctl start.
cd /usr/pgsql-9.0/bin
initdb
pg_ctl start
ASKER
I changed directories
/usr/pgsql-9.0/bin
Tried to run initdb and get the error that initdb : command not found
What am I doing wrong? I am logged as Postgres
/usr/pgsql-9.0/bin
Tried to run initdb and get the error that initdb : command not found
What am I doing wrong? I am logged as Postgres
do an ls on the /usr/pgsql-9.0/bin and post the results back to the thread.
Also ouput the results of echo $PATH as well.
ASKER
/usr/kerberos/bin:/usr/loc al/bin:/us r/bin:/bin :/usr/X118 6/bin:/hom e/co/bin:/ usr/pgsql- 9.0/bin
I added the path Path=$PATH=/usr/pgsql-9.0/ bin
Now I get :
you must identify the directory where the data for this dv system will reside. do this iwth either the invocation option -D or the bash-3.2$ echo $PATH
I tried usr/pgsql-9.0/bin/pg_ctl start /opt/company/CDSDB-ROOT/DA TA
error: usr/pgsql-9.0/bin/pg-ctl : No such file or directory.
I added the path Path=$PATH=/usr/pgsql-9.0/
Now I get :
you must identify the directory where the data for this dv system will reside. do this iwth either the invocation option -D or the bash-3.2$ echo $PATH
I tried usr/pgsql-9.0/bin/pg_ctl start /opt/company/CDSDB-ROOT/DA
error: usr/pgsql-9.0/bin/pg-ctl : No such file or directory.
The problem is that you must first initialize the database before you can start it. as root to do it you can use the command:
service postgresql initdb
but that prob won't work.
in the usr/pgsql-9.0/bin/ directory try ./initdb
If you can't see initdb in that folder you are going to have to reinstall Postgres.
And to set path it isn't Path=$PATH= ... its Path=$PATH: ...
service postgresql initdb
but that prob won't work.
in the usr/pgsql-9.0/bin/ directory try ./initdb
If you can't see initdb in that folder you are going to have to reinstall Postgres.
And to set path it isn't Path=$PATH= ... its Path=$PATH: ...
ASKER
Ok, I see the problem. I used a dash instead of an underscore in my path. duh
I ran
initdb -D /opt/co/CDSDB_ROOT/DATA
initdb could not create direcotry /opt/co/CDSDB_ROOT/DATA permission denied.
(running as postgres)
I ran
initdb -D /opt/co/CDSDB_ROOT/DATA
initdb could not create direcotry /opt/co/CDSDB_ROOT/DATA permission denied.
(running as postgres)
Ok...now you just need to give prostgres permision to write to that folder. you can either chmod the folder to allow writing from all users, or you can chown the folder and its parent folders to be owned by postgres. Then re run the command and you should be good to go.
chmod -R 777 /opt
or
chowm -R postgres /opt
ASKER
I logged into PGAdmin and everything seems to be running. The db connected.
From the Konsole, how do I check the status of the Postgres db?
From the Konsole, how do I check the status of the Postgres db?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window
to get the database running