PostgreSQL: Difference between revisions
(Created page with "==Users== <syntaxhighlight lang="postgres"> CREATE USER myuser WITH ENCRYPTED PASSWORD 'mypass'; ALTER USER david WITH SUPERUSER; </syntaxhighlight>") |
(→Users) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==Getting Started== | |||
===Installation=== | |||
See [https://www.postgresql.org/download/ postgresql download] | |||
===Upgrading=== | |||
See [https://stackoverflow.com/questions/60409585/how-to-upgrade-postgresql-database-from-10-to-12-without-losing-data-for-openpro] | |||
# Backup old postgres cluster | |||
#: <pre>sudo su postgres</pre> | |||
#: <pre>psql_dumpall > export.sql</pre> | |||
# Install new postgresql version | |||
#: <pre>sudo apt install postgresql-13</pre> | |||
# Migrate database and configuration files | |||
## | |||
# Remove and cleanup old postgresql files | |||
## | |||
===Defaults=== | |||
To get into postgres for the first time: | |||
<pre> | |||
sudo -u postgres psql postgres | |||
</pre> | |||
==Users== | ==Users== | ||
<syntaxhighlight lang="postgres"> | <syntaxhighlight lang="postgres"> | ||
/* Create user */ | |||
CREATE USER myuser WITH ENCRYPTED PASSWORD 'mypass'; | CREATE USER myuser WITH ENCRYPTED PASSWORD 'mypass'; | ||
ALTER USER | |||
/* Give superuser */ | |||
ALTER USER myuser WITH SUPERUSER; | |||
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 21:38, 5 April 2021
Getting Started
Installation
Upgrading
See [1]
- Backup old postgres cluster
sudo su postgres
psql_dumpall > export.sql
- Install new postgresql version
sudo apt install postgresql-13
- Migrate database and configuration files
- Remove and cleanup old postgresql files
Defaults
To get into postgres for the first time:
sudo -u postgres psql postgres
Users
/* Create user */
CREATE USER myuser WITH ENCRYPTED PASSWORD 'mypass';
/* Give superuser */
ALTER USER myuser WITH SUPERUSER;