by
back

useful postgresql commands in psql

start psql as postgres user

sudo -u postgres psql

list all databases on postgres server via psql

\l
\list

drop a database on postgres server via psql

drop database "DATABASENAME";

list all users on postgres server via psql

\du

drop an user on postgres server via psql

drop user USERNAME;

select a database on postgres server via psql

\c DATABASENAME

import sql from file into postgres server

sudo -u postgres psql DATABASENAME -f filename.sql


comments powered by Disqus