diff options
author | Silvino Silva <silvino@bk.ru> | 2020-01-19 00:59:14 +0000 |
---|---|---|
committer | Silvino Silva <silvino@bk.ru> | 2020-01-19 00:59:14 +0000 |
commit | ac7c572733282e49801b16531d841682e3ab1b5a (patch) | |
tree | ea66ae0b75117bd8d18b2562af37206eca74a084 /tools/postgresql.html | |
parent | 2832c44d3142f68bb43d3901bf11d21c52cca18b (diff) | |
download | doc-ac7c572733282e49801b16531d841682e3ab1b5a.tar.gz |
documentation date and domain update
Diffstat (limited to 'tools/postgresql.html')
-rw-r--r-- | tools/postgresql.html | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/tools/postgresql.html b/tools/postgresql.html index 285e7c3..1fb48c7 100644 --- a/tools/postgresql.html +++ b/tools/postgresql.html @@ -210,7 +210,7 @@ <pre> $ 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: </pre> @@ -221,7 +221,7 @@ <pre> $ sudo -u postgres createdb --template=template0 --encoding=UTF8 \ - --owner=flyspray db_flyspray + --owner=user_example db_example </pre> <h2 id="dropdb">5. Drop Database</h2> @@ -229,7 +229,7 @@ <p>Deleting database with dropdb command;</p> <pre> - sudo -u postgres dropdb db_flyspray + sudo -u postgres dropdb db_example </pre> <h2 id="dropuser">6. Drop User</h2> @@ -237,7 +237,7 @@ <p>Deleting user with dropuser command;</p> <pre> - sudo -u postgres dropuser flyspray + sudo -u postgres dropuser user_example </pre> <h2 id="psql">7. Psql</h2> @@ -263,32 +263,47 @@ postgres=# \l </pre> + <p>Connect to a datase;</p> + + <pre> + postgres=# \c db_example + </pre> + + <p>List tables;</p> + + <pre> + postgres=# \dt + </pre> + <h3 id="psqldb">7.2. Create Database</h3> <pre> - 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; </pre> - <h3 id="droptables">7.3. Drop Tables</h3> + <h3 id="droptables">7.3. Drop All Tables</h3> <p>This example assumes that all tables, - are in public schema. First connect to database and - list tables;</p> + are in public schema. First revoke previously granted privileges from one or more roles;</p> <pre> - postgres=# revoke SELECT on db_flyspray from flyspray; + postgres=# revoke ALL PRIVILEGES on db_example from user_example; </pre> + <p>Drop all tables on public schema and recreate public schema;</p> + <pre> - postgres=# \c db_flyspray - postgres=# \dt + postgres=# \c db_example + db_example=# drop schema public cascade; + db_example=# create schema public; </pre> - <p>Drop all tables on public schema and recreate public schema;</p> + <h3 id="userpass">7.4. Change user password</h3> + + <p>Update password of a user;</p> <pre> - db_flyspray=# drop schema public cascade; - db_flyspray=# create schema public; + postgres=# ALTER USER user_example WITH ENCRYPTED PASSWORD 'password'; </pre> <h2 id="backup">8. Backup and restore</h3> @@ -307,9 +322,9 @@ <a href="index.html">Tools Index</a> <p> - 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 <a href="../fdl-1.3-standalone.html">Gnu Free Documentation License</a> for copying conditions.</p> </body> |