inline MySQL to Postgres Cheat Sheet

Originally published on June 3rd, 2020 (Last updated on June 3rd, 2020)

Nav­i­gat­ing the psql util­i­ty for peo­ple know­ing the mysql utility:

mysql com­mandDescrip­tionpsql command
USE <db>Switch to DB\c <db>
SHOW TABLESList Tables in DB\dt
SHOW INDEX FROM <table>List index­es of a Table\di <table>
EXPLAIN TABLE <table>Show table schema\d <table>

Dump & Restore #

# Dump the database to a file
pg_dump -U <user> <database> >  dump.sql
# Restore from dump
psql -U <user> <database> < dump.sql

Tak­en from the offi­cial docs

Con­nec­tion URL #

  • Post­gres: postgresql://[user[:password]@][host][:port][/dbname]
  • MySQL: It’s a bit more com­pli­cat­ed


No com­ment sec­tion here 😄

You can reach me over at @knuth_dev or send me an Email.