2024-06-03
This commit is contained in:
52
_-Review/postgre-sql.md
Normal file
52
_-Review/postgre-sql.md
Normal file
@ -0,0 +1,52 @@
|
||||
---
|
||||
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
|
||||
```
|
Reference in New Issue
Block a user