PostgreSQL: Difference between revisions

From David's Wiki
No edit summary
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==

Revision as of 21:37, 5 April 2021

Getting Started

Installation

See postgresql download

Upgrading

See [1]

  1. Backup old postgres cluster
    sudo su postgres
    psql_dumpall > export.sql
  2. Install new postgresql version
    sudo apt install postgresql-13
  3. Migrate database and configuration files
  4. 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;