Run a PostgreSQL .sql file using command line arguments

Of course, you will get a fatal error for authenticating, because you do not include a user name…

Try this one, it is OK for me 🙂

psql -U username -d myDataBase -a -f myInsertFile

If the database is remote, use the same command with host

psql -h host -U username -d myDataBase -a -f myInsertFile

Leave a Comment