PostgreSQL: Difference between revisions
(→Users) |
(→Users) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
==Installation== | ==Getting Started== | ||
===Installation=== | |||
See [https://www.postgresql.org/download/ postgresql download] | |||
===Upgrading=== | ===Upgrading=== | ||
See [https://stackoverflow.com/questions/60409585/how-to-upgrade-postgresql-database-from-10-to-12-without-losing-data-for-openpro] | See [https://stackoverflow.com/questions/60409585/how-to-upgrade-postgresql-database-from-10-to-12-without-losing-data-for-openpro] | ||
Line 11: | Line 14: | ||
# Remove and cleanup old postgresql 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'; | ||
/* Give superuser */ | |||
ALTER USER myuser WITH 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;