MySQL and Postgres Commands

A comparison of commands in MySQL and Postgres.

Action MySQL Postgres
Describe table desc $TABLE \dS $TABLE (also works for indexes)
List tables show tables; \dt
List users show users; \dg
List databases show databases; \l
List triggers show triggers\G;  select * from pg_trigger;
Ending session
(Kind of important)
exit; \q

List indexes: Postgres: \di

List functions: Postgres: \df

List sequences: Postgres: \ds

List extensions: Postgres: \dx

Quick and dirty way to create a user and a database:

In Postgres:

To log in:

User and database recipe for MySQL:

To log into the database via the command line:

To load a database from a dump file:

Postgres SQL commands – Postgres Meta-Commands

MySQL documentation

There is also a comparison of PostgreSQL, MySQL and SQLite at the Hyperpolyglot site.