Posts

Showing posts from April, 2020

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 utilityIn 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
HowtoexcludedatabasedatafrombackupsTo exclude database data from your output file you should include "-s" flag in your commandpg_dump -s "books" > books.sql