how to dump a postgresql database using from the terminal

PostgreSQL is a relational database management system and arguably the best database management around. postgreSQL comes with utilities used to manipulate databases from the terminal "psql" being the most popular utility I'm sure you've read somewhere or used "psql"

dumping "backing" databases is done using PostgreSQL's pg_dump utility

In your terminal type;
pg_dump <database name> > <output>

For instance to backup a database named "books" to a file named "books.sql" do;

pg_dump "books" > books.sql

How to exclude database data from backups

To exclude database data from your output file you should include "-s" flag in your command

pg_dump -s "books" > books.sql

Comments

Popular posts from this blog

What is 'this.' keyword in JavaScript

How to iterate array elements using 'for loop' in JavaScript