PostgreSQL: Difference between revisions

From David's Wiki
No edit summary
 
Line 23: Line 23:
==Users==
==Users==
<syntaxhighlight lang="postgres">
<syntaxhighlight lang="postgres">
# Create user
/* Create user */
CREATE USER myuser WITH ENCRYPTED PASSWORD 'mypass';
CREATE USER myuser WITH ENCRYPTED PASSWORD 'mypass';


# Give superuser
/* 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

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;