MariaDB

This guide will walk you through on setting up a MariaDB server on Ubuntu 16.04 LTS.

Adding Repo

sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.2/ubuntu xenial main'
sudo apt-get update

Installing

sudo apt-get install mariadb-server

Setup

Run mysql_secure_installation

Configuring

  1. Navigate to your MariaDB config (Ex: /etc/mysql/mariadb.conf.d/50-server.cnf)

  2. Comment out bind-address by prefixing it with a #, so it looks like #bind-address = 127.0.0.1

  3. Restart MySQL via sudo systemctl restart mysql

Granting Permission

Sign in to MySQL shell via sudo mysql -u root -p and enter your password

Run the following, adjusting it to suit your own needs

  • Username - The user you wish to create

  • Host - The host you wish to whitelist

  • Password - The password to use for the user creation

    GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'@'HOST' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;
    FLUSH PRIVILEGES;
    

Done!

From here on, you are done with setting up a MariaDB server!