Introduction
This document describes on how to log in to the PostgreSQL database on CloudCenter and use basic commands within the database (DB).
How do you confirm that the DB is running and able to be connected to?
Follow these command line inputs and outputs to confirm if you can connect to the database and that it is running.
# ps -ef | grep postgres
# postgres 802 1 0 Jan09 ? 00:00:27 /usr/pgsql-9.5/bin/postgres -D /var/lib/pgsql/9.5/data
# postgres 802 1 0 Jan09 ? 00:00:27 /usr/pgsql-9.5/bin/postgres -D /var/lib/pgsql/9.5/data
# postgres 1010 802 0 Jan09 ? 00:00:00 postgres: logger process
# postgres 1071 802 0 Jan09 ? 00:00:04 postgres: checkpointer process
# postgres 1072 802 0 Jan09 ? 00:00:14 postgres: writer process
# postgres 1073 802 0 Jan09 ? 00:00:13 postgres: wal writer process
# postgres 1074 802 0 Jan09 ? 00:00:16 postgres: autovacuum launcher process
# postgres 1075 802 0 Jan09 ? 00:00:40 postgres: stats collector process
# postgres 5082 802 0 08:57 ? 00:00:00 postgres: cliqr cliqrdb 127.0.0.1(43594) idle
# postgres 5121 802 0 09:09 ? 00:00:00 postgres: cliqr cliqrdb 127.0.0.1(43602) idle
# postgres 5125 802 0 09:11 ? 00:00:00 postgres: cliqr cliqrdb 127.0.0.1(43604) idle
How do you log in to the DB on the CloudCenter Manager (CCM)?
To log in to the DB on the Cloud Center Manager, run this command: psql -U cliqr -d cliqrdb.
The CCM prompts you for a password which is cliqr.
This connects you to the cliqrdb DB as user cliqr.
How do you query the DB once you are logged in?
To query the DB you can run a select command like select * from cloud_types;
cloud_types is a table in the cliqrdb.
How do you exit from the DB?
To exit from the DB use type \q
What are some other basic DB commands?
This is a list of basic commands to run on the DB to get various pieces of information:
- List all of the DB manipulation commands such as ALTER or CREATE
- List all of the command prompt commands
- List all of the DB tables from the user
- Show the DB definitions
- Show all of the DBs
- Show all DB users
- Show all index from the user
Why is it not doing anything when you put in a command?
All commands must end in a semi-colon ';', if you do not put one in it thinks you simply want a new line in the middle of the command.