Skip to content

Databases

Running PostgreSQL and MariaDB: connecting, creating users and databases, granting rights, checking whether the server is alive and securing a fresh installation.

Basics: PostgreSQL or MariaDB, packages and paths per distribution, how login works, users and rights, access from other machines

PostgreSQL

  • psql


    Connect, run SQL, inspect databases and roles.

  • createuser


    Create a PostgreSQL role.

  • createdb


    Create a PostgreSQL database.

  • pg_isready


    Does the server accept connections?

  • pg_lsclusters


    Clusters, versions and ports (Debian, Ubuntu).

MariaDB

From other chapters

  • pg_dump


    Back up PostgreSQL databases. Covered in the chapter Backup.

  • mysqldump


    Back up MariaDB and MySQL databases. Covered in the chapter Backup.

  • ss


    Check on which address the database listens. Covered in the chapter Network.

  • ufw


    Open the database port only for application servers. Covered in the chapter Network.