In this article, i am going to show you the steps to connect to the postgre database.
First you need to know the port on which postgresql is running. To know this use the following command ..
grep -i postgresql /etc/services
The output from the above command lists you the port the postgre is using. Now use the following command to connect to the postgre.
Assuming you installed your postgre with user "postgres" and the port used by postgre is 5432. Now switch user to postgres and connect to it.
[root@askmlabstools pgsql]# su postgres
bash-4.1$ psql -p5432 -dpostgres
psql (8.4.18)
Type "help" for help.
postgres=# select name,setting from pg_settings where name='post';
name | setting
------+---------
(0 rows)
postgres=# select name,setting from pg_settings where name='poRT';
name | setting
------+---------
(0 rows)
postgres=# select name,setting from pg_settings where name='port';
name | setting
------+---------
port | 5432
(1 row)
postgres=# select * from pg_user;
usename | usesysid | usecreatedb | usesuper | usecatupd | passwd | valuntil | useconfig
----------+----------+-------------+----------+-----------+----------+----------+-----------
postgres | 10 | t | t | t | ******** | |
nagiosxi | 16384 | f | f | f | ******** | |
(2 rows)
postgres=# exit
postgres-# \q
Hope it help.
SRI
Post a Comment
Thank you for visiting our site and leaving your valuable comment.