![]() With given options pg_dump will first prompt for a password for the database user db_user and then connect as that user to the database named db_name. To see a list of all the available options use pg_dump -?. ![]() -F is used to specify the format of the output file, which can be one of the following:Ĭustom, directory and tar formats are suitable for input into pg_restore.-W or -password will force pg_dump to prompt for a password before connecting to the server.-U to specify which user will connect to the PostgreSQL database server.So, if the database is stored on a remote server, you will need to SSH to that server in order to run the following command: pg_dump -U db_user -W -F t db_name > /path/to/your/file/dump_name.tar We need to run pg_dump in the command line on the computer where the database is stored. To export PostgreSQL database we will need to use the pg_dump tool, which will dump all the contents of a selected database into a single file. A while ago Slobodan wrote how to export and import a mySQL dump, and here is a guide how to backup and restore a PostgreSQL database. While working on different projects and in different environments, we often need to export a dump from one database and then import it into another.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |