Saturday, December 27, 2014

Debian 7 & Postgres post installation changes

Check if PgSql is running: 
                    Check PgSQL Is Running:/etc/init.d/postgresql status
Restart:service postgresql restart
Start:service postgresql start
Stop:service postgresql stop
Doing First Login:
su -l root
su - postgres
psql -d template1 -U postgres
Lists databases:
SELECT datname FROM pg_database WHERE datistemplate = false;
or
\list
List Tables:
SELECT table_schema,table_name FROM information_schema.tables
ORDER BY table_schema,table_name;
           or
\dt
List User:
                     \du
List Roles:
           SELECT rolname FROM pg_roles;
CREATE user & associate database to it:
CREATE USER san WITH PASSWORD 'urpwd';
CREATE DATABASE pgDb;
                 GRANT ALL PRIVILEGES ON DATABASE pgdb to san;
Create User In Debian using BASH:
useradd san
passwd san
Delete User in Debian:
userdel san
Login into PgSql terminal as new user:
       su - san
       psql -d pgDb -U san
Connect Using PgAdmin using following details
Server:localhost
port:5432 (Default)
User:san
password:urpasswd

No comments:

Post a Comment