Skip to main content

Posts

Showing posts from September, 2012

How to check if the postgres server is running?

Change your directory to /etc/init.d you can do that by running below command: > cd /etc/init.d then run below command for checking postgresql service > ls                         Note:  this command will list the objects in the init.d directory and this is not specific to postgres. check if the postgresql is present in the result returned by ls cmd. If it's not present then your postgres is not installed properly and try installing again. If the postgresql is present then run below cmd : > postgresql status this will ask you for postgres possword enter the password. this will return something like this : pg_ctl: server is running (PID: 6171) /usr/local/pgsql/bin/postgres "-D" "/usr/local/pgsql/data" [ Note : The status above indicates the server is up and running] If the server is not returning then it will be like : pg_ctl: no server running

How to login into Postgres using terminal in Linux

The default location of postgres in linux is : /opt/PostgreSQL/8.4/ You can go to this location by typing the below command > cd /opt/PostgreSQL/8.4/ change to bin directory > cd bin/ Now for logging into the postgres run following command : > /opt/PostgreSQL/8.4/bin/psql -U postgres where 'postgres' is the username that was asked to you while installing the postgres.After this command it will ask you for password. Then enter the password and you are logged in.