Import .sql file into database schema in PostgreSQL

Just wanna post snippet code import .sql file into particular database schema in PostgreSQL. Here is the command :

muhammad@muhammad-laptop:~$ psql your_db_schema < your_file.sql --host localhost --port 5432 --username "postgres" --no-password 

use –password “your_password” if you are using password to access your PostgreSQL, please ensure that your psql classpath has installed properly. you can check by using command :

muhammad@muhammad-laptop:~$ which psql
/usr/bin/psql

Leave a Reply