mirror of
https://github.com/aliasvault/aliasvault.git
synced 2026-01-03 19:49:48 -05:00
1.9 KiB
1.9 KiB
layout, title, parent, grand_parent, nav_order
| layout | title | parent | grand_parent | nav_order |
|---|---|---|---|---|
| default | PostgreSQL Commands | Development | Miscellaneous | 2 |
PostgreSQL Commands
Backup database to file
To backup the database to a file, you can use the following command:
docker compose exec postgres pg_dump -U aliasvault aliasvault | gzip > aliasvault.sql.gz
Import database from file
To drop the existing database and restore the database from a file, you can use the following command:
{: .warning } Executing this command will drop the existing database and restore the database from the file. Make sure to have a backup of the existing database before running this command.
docker compose exec postgres psql -U aliasvault postgres -c "DROP DATABASE aliasvault;" && \
docker compose exec postgres psql -U aliasvault postgres -c "CREATE DATABASE aliasvault;" && \
gunzip < aliasvault.sql.gz | docker compose exec -iT postgres psql -U aliasvault aliasvault
Change master password
By default during initial installation the PostgreSQL master password is set to a random string that is
stored in the .env file with the POSTGRES_PASSWORD variable.
If you wish to change the master password, you can do so by running the following command:
- Open a terminal and navigate to the root of the AliasVault repository.
- Run the following command to connect to the PostgreSQL container:
docker compose exec -it postgres psql -U aliasvault -d aliasvault - Once connected to the database, you can change the master password by running the following command:
ALTER USER aliasvault WITH PASSWORD 'new_password'; - Press Enter to confirm the changes.
- Exit the PostgreSQL shell by running
\q. - Manually update the
.envfile variablePOSTGRES_PASSWORDwith the new password. - Restart the AliasVault containers by running the following command:
docker compose restart