Postgresql - danwu960/MyDocument GitHub Wiki
postgres@recogito-1:~$ psql -c -U postgres -f /file-path-to-the-dump-sql/
#-U username #-f file-path #-c cleaning objects before recreating the database
- https://www.postgresql.org/files/documentation/pdf/14/postgresql-14-A4.pdf
- https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-20-04
#login postgressql with username postgre
sudo -i -u postgres
#create users and databases needed for restoring, roles such as "recogito", "recogito_owner", "recogito_backup"
- postgres@recogito:~$createuser recogito_owner with createdb;
- postgres@recogito:~$alter role recogito_owner with password ' ';
- postgres@recogito:~$grant all privileges on database recogito to recogito_owner;
- postgres@recogito:~$createdb recogito
#restor db
psql -U postgres --set ON_ERROR_STOP=on -d recogito -f /file-path-dump.sql
#connect to a database
-sudo -u recogito_owner psql recogito