Configuring database services (revision 1)

Introduction

This page describes how Alexis Huxley installed the MariaDB server software on his own systems.

Hardware requirements

unknown

Procedure

This procedure is very very rough because I wrote it after actually doing it rather than in parallel.

  1. Run:
    apt-get install mariadb-server
    
  2. To allow TCP connections from anywhere edit /etc/mysql/mariadb.conf.d/50-server.cnf and set:
    [mysqld]
    ...
    bind-address = 0.0.0.0

    and then run:

    service mariadb restart
    

MariaDB basics

  1. Create a user and allow them to create databases that start with their login by running something like:
    arata# mariadb
    MariaDB> CREATE USER 'alexis'@'%' IDENTIFIED BY 'alexispassword';
    

    (see: CREATE USER)

  2. Allow the user to do anything (except grant privileges):
    MariaDB> GRANT ALL PRIVILEGES ON *.* TO 'alexis'@'%';

    or create a database and grant the user priviliges on that database only:

    MariaDB> CREATE DATABASE testdb;
    MariaDB> GRANT ALL PRIVILEGES ON testdb.* TO 'alexis'@'%';

    (see: CREATE DATABASE, GRANT)

  3. Show all grants:
    MariaDB> SELECT grantee, privilege_type FROM information_schema.user_privileges;
  4. Revoke all grants:
    MariaDB> REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'alexis'@'%';

    (see: REVOKE)

  5. Configure client to autoconnect:
    echo -e '[mysql]\nhost=arata.pasta.net\npassword="alexispassword"' > ~/.my.cnf

    (see: mariadb man page; file options are command line options but without the -- prefix.)

See also