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:
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.
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.
- Network Type: Check your network type matches your needs.
- Key 3: Set a root password for the database. Keep it secure! Not setting one could result in issues.
- Hit Apply and wait for the install to finish.
- 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.
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.
- Head back to the app store and search for Adminer
- Once again, you don't need to modify it beyond the defaults and your network type.
- Hit Apply and wait for the install to complete.
- Once finished, head back to your Docker tab.
- Left-click the Adminer container and select WebUI
- 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.
- Once you sign in, you'll see some databases in there by default.
- In the top left we can create a new one.
- 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.
- 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.
- Select Privileges. This will allow us to create a user that has permission to use this database only.
- Select Create User
- 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.
- Check the box beside All Privileges.
- Scroll to the bottom and hit Save.
And that's pretty much it! You now have:
- Database server
- Database created
- 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
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.