From ac7c572733282e49801b16531d841682e3ab1b5a Mon Sep 17 00:00:00 2001
From: Silvino Silva Deleting database with dropdb command; Deleting user with dropuser command; Connect to a datase; List tables; This example assumes that all tables,
- are in public schema. First connect to database and
- list tables;
$ sudo -u postgres createuser --pwprompt --encrypted \
- --no-createrole --no-createdb flyspray
+ --no-createrole --no-createdb user_example
Enter password for new user:
Enter it again:
@@ -221,7 +221,7 @@
$ sudo -u postgres createdb --template=template0 --encoding=UTF8 \
- --owner=flyspray db_flyspray
+ --owner=user_example db_example
5. Drop Database
@@ -229,7 +229,7 @@
- sudo -u postgres dropdb db_flyspray
+ sudo -u postgres dropdb db_example
6. Drop User
@@ -237,7 +237,7 @@
- sudo -u postgres dropuser flyspray
+ sudo -u postgres dropuser user_example
7. Psql
@@ -263,32 +263,47 @@
postgres=# \l
+
+ postgres=# \c db_example
+
+
+
+ postgres=# \dt
+
+
7.2. Create Database
- postgres=# create database db_flyspray_ext owner flyspray encoding 'UTF-8' template template0;
+ postgres=# create database db_example_ext owner user_example encoding 'UTF-8' template template0;
- 7.3. Drop Tables
+ 7.3. Drop All Tables
- postgres=# revoke SELECT on db_flyspray from flyspray; + postgres=# revoke ALL PRIVILEGES on db_example from user_example;+
Drop all tables on public schema and recreate public schema;
+- postgres=# \c db_flyspray - postgres=# \dt + postgres=# \c db_example + db_example=# drop schema public cascade; + db_example=# create schema public;-
Drop all tables on public schema and recreate public schema;
+Update password of a user;
- db_flyspray=# drop schema public cascade; - db_flyspray=# create schema public; + postgres=# ALTER USER user_example WITH ENCRYPTED PASSWORD 'password';
- This is part of the Hive System Documentation. - Copyright (C) 2019 - Hive Team. + This is part of the Tribu System Documentation. + Copyright (C) 2020 + Tribu Team. See the file Gnu Free Documentation License for copying conditions.