To create a database in PostgreSQL and make it accessible:
postgresql-contrib
package also). Make sure it
is up and running.Switch to postgres
user:
$ sudo su - postgres
Start psql
:
$ psql
Create a user <username>
with password <password>
:
postgres=# CREATE USER <username> WITH PASSWORD '<password>';
Create a database <dbname>
:
postgres=# CREATE DATABASE <dbname> OWNER <username> ENCODING 'utf8';
Connect to the database:
postgres=# \c <dbname>
Activate uuid-ossp
extension:
<dbname>=# CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
\q
to quit.^D
to exit the postgres
user shell.Under superuser, edit /var/lib/pgsql/data/pg_hba.conf
(/etc/postgresql/*/main/pg_hba.conf
in Debian) and add the
following lines to it:
# TYPE DATABASE USER ADDRESS METHOD
local <dbname> <username> password
host <dbname> <username> 127.0.0.1/32 password
host <dbname> <username> ::1/128 password
$ sudo systemctl restart postgresql
There is no need to create any tables in the database. moera-node
creates them
automatically on the first start and upgrades the structure when a new version is
run.