4,461
edits
m →Initial set-up: adding of usage section |
|||
Line 1: | Line 1: | ||
= Initial set-up = | = Initial set-up = | ||
Install | Install (the default is v10.23 as of 2023-10-13) | ||
{{testedon|RHEL 8.8 (Ootpa)|2023-10-13}} | {{testedon|RHEL 8.8 (Ootpa)|2023-10-13}} | ||
Line 8: | Line 8: | ||
$ sudo yum module list | grep postgresql | $ sudo yum module list | grep postgresql | ||
$ sudo yum install @postgresql | $ sudo yum install @postgresql | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 15: | Line 14: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
$ sudo yum install @postgresql:9.6 | $ sudo yum install @postgresql:9.6 | ||
</syntaxhighlight> | |||
for the initial set-up | |||
<syntaxhighlight lang="bash"> | |||
$ sudo postgresql-setup --initdb | |||
* Initializing database in '/var/lib/pgsql/data' | |||
* Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log | |||
</syntaxhighlight> | |||
for setting up a password for the postgres account | |||
<syntaxhighlight lang="bash"> | |||
$ sudo passwd postgres | |||
Changing password for user postgres. | |||
New password: | |||
Retype new password: | |||
passwd: all authentication tokens updated successfully. | |||
</syntaxhighlight> | |||
enable PostgreSQL server at the boot time | |||
<syntaxhighlight lang="bash"> | |||
$ sudo systemctl enable postgresql | |||
</syntaxhighlight> | |||
= Prerequisite for psql console = | |||
change to postgres user account | |||
<syntaxhighlight lang="bash"> | |||
$ sudo -iu postgres | |||
</syntaxhighlight> | |||
log into postgres console | |||
<syntaxhighlight lang="bash"> | |||
$ psql | |||
psql (10.23) | |||
Type "help" for help. | |||
postgres=# | |||
</syntaxhighlight> | |||
= Usage = | |||
{| class="wikitable sortable" | |||
|+ PostgreSQL | |||
|- | |||
! Command !! Action !! Description or Notes | |||
|- | |||
| <code>\q</code> || Quit || | |||
|- | |||
| Example || Example || Example | |||
|- | |||
| Example || Example || Example | |||
|} | |||
<code>\q</code> | |||
<syntaxhighlight lang="bash"> | |||
</syntaxhighlight> | </syntaxhighlight> | ||