From eefd14178c07ef17b064f7291ce16556218741a6 Mon Sep 17 00:00:00 2001 From: Cory <16737666+corybiscuit@users.noreply.github.com> Date: Sat, 2 Aug 2025 15:40:01 -0400 Subject: [PATCH] Added PostgreSQL knowledge --- docs/knowledge-base/postgresql.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 docs/knowledge-base/postgresql.md diff --git a/docs/knowledge-base/postgresql.md b/docs/knowledge-base/postgresql.md new file mode 100644 index 0000000..c1f2304 --- /dev/null +++ b/docs/knowledge-base/postgresql.md @@ -0,0 +1,28 @@ +--- +title: PostgreSQL +description: PostgreSQL server information +icon: simple/postgresql +--- + +## Databases + +| Database | Address | Port | User | +| ----------- | ----------- | ---- | -------- | +| postgres | 10.10.10.20 | 5432 | postgres | +***All passwords stored in KeePassXC database.*** + +## Cheatsheet + +| Usage | Command +| :-------------------------------------------------------------|:------------- +| Open postgres with `postgres` user permission | `sudo -u postgres psql` +| Check Postgres version | `select version();` +| Show all users with permissions | `\du` +| List all databases | `\l` +| Create a database | `CREATE DATABASE _mydb_;` +| Create a user with a password | `CREATE USER _myuser_ WITH PASSWORD 'mypassword';` +| Grant all permission of a database to Postgres user | `GRANT ALL PRIVILEGES ON DATABASE _mydb_ TO _myuser_;` +| Connect to a database | `\c _db_name_` +| Connect to a database as specific user | `\c _db_name_ _pg_user_` +| Switch back to default database | `\c postgres postgres` +| Create a table | `CREATE TABLE _table_name_;` \ No newline at end of file