Run a PostgreSQL .sql file using command line arguments
Solution 1:
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
Solution 2:
You should do it like this:
\i path_to_sql_file
See: