Create a Database with MariaDB on unRAID

3 months ago   •   4 min read

By Sycotix
Table of contents

Databases

Who runs the world? It's databases. Without them, we would be relying on recreating every transaction or remembering every exchange of information ourselves - live. That's a recipe for disaster.

Instead, we have databases. They come in many shapes and sizes, adding to the confusion of deciding on which is best in each use case. To help with that, we can start with one of the most commonly used database servers - MariaDB.

MariaDB Server is one of the most popular open-source relational databases. It’s made by the original developers of MySQL and guaranteed to stay open source. It is part of most cloud offerings and the default in most Linux distributions.

It's easy to use and easy to read. Lending itself to beginners in the realm of managing a database. Together with an interface tool called Adminer, we can really get an easy approach to create and use a database.

So let's get to the install.

Prefer to watch the video? Here you go:


Installation

unRAID

Sign in to your unRAID server and head to the Community Apps store.

Don't have the Community Apps store? Watch our YouTube video to learn how to activate it.

MariaDB

Search for and install MariaDB. The team over at LinuxServer have made a great image as usual.

There isn't much to change on the template screen.

  1. Network Type: Check your network type matches your needs.
  2. Key 3: Set a root password for the database. Keep it secure! Not setting one could result in issues.
  1. Hit Apply and wait for the install to finish.
  2. Once it's finished, head to your Docker tab.
You may want to check the Autostart toggle to ensure it starts with your Unraid system.

Congratulations! You now have a database server running. But there's another important step to create a database on this database server.


Adminer

All we have done so far is set up the database server. When you install an application that needs a database (if you are following our YouTube videos, Authelia, for example), you need to create a database within our new instance.

So, we'll use Adminer to do that.

  1. Head back to the app store and search for Adminer
  1. Once again, you don't need to modify it beyond the defaults and your network type.
  1. Hit Apply and wait for the install to complete.
  2. Once finished, head back to your Docker tab.
  3. Left-click the Adminer container and select WebUI
  1. On the WebUI screen, you can now sign in to your database server using the settings configured in our MariaDB instructions from earlier.
* System = MySQL. You have plenty of other options for other database types, too!
* Server = IP address of your unRAID server where MariaDB is installed
* Username = root
* Password = Configured in Step 2 above
* Database = Leave blank. After we create a database (following steps) you can enter the name here to sign directly to that database.
  1. Once you sign in, you'll see some databases in there by default.
  2. In the top left we can create a new one.
  1. On the following screen you enter the name of the database. It's good practice to name it after the application you intend to use it for. i.e. Authelia
Unless you have been given specific instructions, you do not need to select a collation. So applications may require a specific type of collation, if so, pick it here.
  1. Select Save.

On the next screen, you'll see we're now inside of our new database. There's nothing in it yet, no tables, no rows - nothing.

  1. Select Privileges. This will allow us to create a user that has permission to use this database only.
  1. Select Create User
  1. Complete the fields shown. The information you put in here will be used by the application which use it to connect and read/write data.

Keep the password seperate to your root password for additional security.

  1. Check the box beside All Privileges.
  2. Scroll to the bottom and hit Save.

Final Words

And that's pretty much it! You now have:

  1. Database server
  2. Database created
  3. User that can access that one database

When it comes to the application you are setting this up for, it will usually require the following fields based on what you set above. Here's an example taken from our Authelia tutorial:

  mysql:
    host: 192.168.1.101
    port: 3306
    database: authelia
    username: authelia
    password: DATABASEPASSWORD

Thanks

If you enjoyed this article please consider subscribing to our site and our YouTube channel, it really helps!

In the next article we'll be showing you how to install and configure Cachet, an open-source and free Status Page system. And now our database will be ready!

If you want to get a headstart before the tutorial, we have pushed a template to the Community Apps store for you to use.

Thanks for reading.

Spread the word

Keep reading