psql opening a database code example Example 1: psql execute sql file db=> \i my_script.sql Example 2: psql connect to another database \c DBNAME \connect DBNAME