Postgresql: Difference between revisions

From DWIKI
No edit summary
 
(8 intermediate revisions by the same user not shown)
Line 2: Line 2:
*[http://www.postgresql.org/ Homepage]
*[http://www.postgresql.org/ Homepage]
*[http://www.freebsddiary.org/postgresql.php Postgresql on freebsd]
*[http://www.freebsddiary.org/postgresql.php Postgresql on freebsd]
*[http://www.pgbarman.org/ Backups for postgresql]
=Documentation=
*[https://www.postgresqltutorial.com/postgresql-administration/ Postgresql Administration]


=Installation=
=Installation=
Line 8: Line 12:
*http://www.freebsddiary.org/postgresql.php (doesn't seem entirely right)
*http://www.freebsddiary.org/postgresql.php (doesn't seem entirely right)


(pg_ctl: could not read file "/usr/local/pgsql/data/postmaster.opts") :
After installing and creating db:
After installing and creating db:
As user pgsql
As user pgsql
Line 15: Line 21:
Ater which it should be possible to run ( as root again)
Ater which it should be possible to run ( as root again)
  /usr/local/etc/rc.d/postgresql start
  /usr/local/etc/rc.d/postgresql start
=HOWTO=
==Back up postgresql databases==
*[https://www.postgresql.org/docs/current/backup.html Backup and Restore]


 
pg_restore --disable-triggers --clean -d davical  /tmp/davical


=FAQ=
=FAQ=
Line 22: Line 31:
  su - postgres
  su - postgres
  createuser
  createuser
or in psql:
CREATE DATABASE yourdbname
CREATE USER youruser WITH ENCRYPTED PASSWORD 'yourpass'
GRANT ALL PRIVILEGES ON DATABASE yourdbname TO youruser
==ERROR: character 'xxx' of encoding "UTF8" has no equivalent in "LATIN9" locale==
Check
show server_encoding
show client_encoding
\encoding
==List users==
su to postgres, psql and then
\du
==Delete user==
drop user

Latest revision as of 13:57, 22 October 2023

Links

Documentation

Installation

Postgresql on freebsd


(pg_ctl: could not read file "/usr/local/pgsql/data/postmaster.opts") : After installing and creating db: As user pgsql

/usr/local/bin/postmaster -D /usr/local/pgsql/data
pg_ctl stop

Ater which it should be possible to run ( as root again)

/usr/local/etc/rc.d/postgresql start

HOWTO

Back up postgresql databases

pg_restore --disable-triggers --clean -d davical  /tmp/davical

FAQ

Create user

su - postgres
createuser


or in psql:

CREATE DATABASE yourdbname
CREATE USER youruser WITH ENCRYPTED PASSWORD 'yourpass'
GRANT ALL PRIVILEGES ON DATABASE yourdbname TO youruser

ERROR: character 'xxx' of encoding "UTF8" has no equivalent in "LATIN9" locale

Check

show server_encoding
show client_encoding
\encoding

List users

su to postgres, psql and then

\du


Delete user

drop user