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

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>