Using Psql On The Command Line To Examine PostgreSQL Databases

Posted by Weston Ganger

I keep finding myself looking for this information so I have started compiled a cheatsheet of psql commands. Enjoy.


$ psql postgres

\l #show all databases
\c databaseName #switch databases
\dt #show all tables in current database
\d+ tableName #show schema of tableName in current database
\du #show all users
create database databaseName; #create database
drop database databaseName; #drop database
\q #quit

ALTER USER myuser WITH SUPERUSER; #make user a superuser
ALTER USER myuser WITH NOSUPERUSER; #remove superuser from user

Article Topic:Software Development - Linux

Date:April 15, 2015

Recommended Posts

Contact

604-309-8713
info@solidfoundationwebdev.com

Send Me A Message

I would love to get in touch and talk about your next project. Feel free to send a message and I will get back to you shortly.

Get Connected