notes-infineon/_-Review/postgre-sql.md
2024-06-03 07:04:29 -07:00

53 lines
836 B
Markdown

---
type: "note"
---
# PostgreSQL
- [postgresql](https://www.postgresql.org/download/linux/ubuntu/)
```bash
apt install postgresql
```
- [wsl-database](https://learn.microsoft.com/en-us/windows/wsl/tutorials/wsl-database)
```bash
apt install postgresql postgresql-contrib -y
psql --version
service postgresql status
service postgresql start
# service postgresql stop
passwd postgres
sudo -u postgres psql
```
```sql
\q
```
```bash
su postgres
createdb immich_database
psql
```
```sql
\c immich_database
\q
```
- [ ] TODO: Fix
```bash
cat /mnt/d/8-Move/Backups/immich_database_2024-04-25T220025.sql | psql immich_database
gunzip -c /mnt/d/8-Move/Backups/immich_database_2024-04-25T220025.sql.xz | psql dbname
createdb dbname
gunzip -c filename.gz | psql dbname
psql -h 127.0.0.1 -d databasename -U username -f file.sql
```