User Tools

Site Tools


Installing MariaDB

Actual install

I recommend installing both the server and the client software

apt install mariadb-client mariadb-server

Should be automatically activated, if not you may need

sudo systemctl enable mariadb
sudo systemctl start mariadb

Securing Installation

MariaDB comes with a tool named mysql_secure_installation for some basic securing of the installation, I highly recommend running it.

sudo mysql_secure_installation

It will ask of some questions

  • Set root password? [Y]
    • Set a password (even 'root' is better than none at all)
  • Remove anonymous users? [Y]
  • Disallow root login remotely? [Y]
  • Remove test database and access to it? [Y]
  • Reload privilege tables now? [Y]

That's removes a number of altogether unnecessary potential security issues.

Allowing TCP Access

Per default access to MariaDB is by means of Unix sockets but for many purposes (read: using much client software) you need to access it using TCP. To check if that is possible issue sudo mysql and execute the following SQL statement:

select user,host,password,plugin from mysql.user where user='root';

The column plugin must not contain unix_socket plugin. If it does, remove it as follows.

update mysql.user set plugin='' where user='root';
flush privileges;

flush privileges is necessary, otherwise the change has no effect.

Create a new user with full access to a certain database

Here is one example for a mediawiki user.

CREATE USER 'mediawiki'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON mediawiki.* TO 'mediawiki'@'localhost';

Obviously you should consider replacing password by something more reasonable 🙂

installation_guides/mariadb.txt · Last modified: 2020/09/07 13:36 by jupp