List of useful PostgreSQL commands
From time to time I come across PostgreSQL databases that I have to interact with. But the command syntax is somewhat different than what I’m used to from other databases like MSSQL or MySQL. This is a collection of commands I use, but often forget.
$ psql -U user -d dbname -c "# SQL command" -f ./script.sql
db=# \c databasename
List tables in current database
Show all available commands
Change database user password
ALTER USER user_name WITH PASSWORD 'new_password';