MariaDB - PDX-Checkers/checkers GitHub Wiki

This assumes that you're working on some relatively recent version of Ubuntu.

Installing

$ sudo apt install mariadb-server

Starting the Service

$ sudo systemctl enable mariadb
$ sudo systemctl start mariadb

Configuring

$ sudo mysql_secure_installation

Choose reasonable defaults; we're running locally anyway, so nothing really matters.

By default, the Unix socket that's used to connect to MariaDB doesn't work with authentication. Login with

$ sudo mysql -u root

Run the following command inside the root MariaDB shell.

MariaDB [(none)]> UPDATE mysql.user SET plugin = 'mysql_native_password', Password = PASSWORD('NEWPASSWORD') WHERE User = 'root';

where NEWPASSWORD is the root password you want.

MariaDB [(none)]> FLUSH PRIVILEGES;

You should be able to login as normal.

Creating a User

Create an account with

MariaDB [(none)]> CREATE USER 'user'@'localhost' IDENTIFIED BY 'NEWPASSWORD';

Creating a Database

MariaDB [(none)]> CREATE DATABASE checkers;

Granting User Database Privileges

MariaDB [(none)]> GRANT ALL PRIVILEGES ON checkers.* TO 'user'@'localhost';

Connecting Checkers to the Database

Create a file in ~/.config/dbConfig.json. The file should contain the following, with your username and password changed to fit your own configuration.

{
    "user":"AzureDiamond",
    "password":"hunter2",
    "host":"localhost"
}