Install PostgreSQL client on mac using Homebrewclient
Mac:
> brew install postgresql
DPay Credentials
...
Ubuntu:
> apt-get install postgresql-client
Connect using psql
> psql --host=tardis.dev.pci.irdeto.com --port=5433 --dbname=postgres --username=dbmaster --password
or
> psql -h db-master -p 5432 -U keystone -W
Dump Database
> pg_dump --host=localhost --port=5432 --dbname=TardisDB --username=dbmaster --password >db_dump.sql
...
> GRANT ALL PRIVILEGES on DATABASE <dbname> TO <user>;
Update a Field in a Table
> update <table> set <field> = <value> where <other_field> = <othe_value>;
ex: update flyway_schema_history set checksum = -673794054 where version = '000003';
Common Commands
Command | Description |
---|---|
\l \list \l+ | List databases List with additional information |
\dt | Llist List all tables in the current database |
\d \d+ | List all tables, views and sequesncessequences |
\connect database_name | Connect to the database |
\d table | Describe table |
select usename from pg_user | List users |
...