PostgreSQL: Difference between revisions

Created page with "==Users== <syntaxhighlight lang="postgres"> CREATE USER myuser WITH ENCRYPTED PASSWORD 'mypass'; ALTER USER david WITH SUPERUSER; </syntaxhighlight>"
 
 
(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 david WITH SUPERUSER;
 
/* Give superuser */
ALTER USER myuser WITH SUPERUSER;
</syntaxhighlight>
</syntaxhighlight>