A Complete Guide to Install MariaDB Server on Manjaro 18.0

MariaDB is a fork of MySQL server, a popular RDBMS database available for free. Personally, I use MySQL or MariaDB to power up this blog and also I use it to store my spatial datasets. Well, there are many companies that rely their data on MariaDB. I was working on a Gold Exploration company which uses MariaDB server to store our drilling and exploration data. On this article, you will find an easy way to install MariaDB Server on Manjaro 18.0. Manjaro 18.0 is now available for download. It is a great, beautiful and stable Linux operating system. 

In most cases, you may want to install MariaDB Server on your system directly. But, there is also a new way to install and run MariaDB Server, by using Docker container. I will explain these two ways to install MariaDB on Manjaro 18.0. Let’s start. 

Lesson 1. Install MariaDB Server on Manjaro 18.0 directly

You can get the server up and running by executing this command below on Terminal. 

sudo pacman -S mariadb

Output:

[dhani@dhani-pc ~]$ sudo pacman -S mariadb
[sudo] password for dhani: 
resolving dependencies...
looking for conflicting packages...

Packages (4) jemalloc-1:5.1.0-1 libmariadbclient-10.1.35-1
mariadb-clients-10.1.35-1 mariadb-10.1.35-1

Total Download Size: 32,58 MiB
Total Installed Size: 230,31 MiB

:: Proceed with installation? [Y/n]

After the installation finishes, continue with this command

sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

The command will initialize the Mariadb database for the first time. You can change the value of the datadir option if you don’t want to use the default one. In this example, I use my /var/lib/mysql to store the database. 

Next, start the service

sudo systemctl start mariadb
sudo systemctl enable mariadb

Next, we need to secure the MariaDB

sudo mysql_secure_installation

Follow on screen instructions until it completed. Now your server should be ready. 

Install MySQL Workbench 8.0 on Manjaro 18.0

It is optional, but we recommend you to install MySQL Workbench 8.0 on Manjaro. Workbench is an official GUI tool to manage MySQL server. 

sudo pacman -S mysql-workbench

In a moment, the Workbench is ready to use

Lesson 2. Install and Run MariaDB Server Container

There is another way to install MariaDB Server on Manjaro Linux. On this lesson, we are going to run MariaDB server container using Docker. If you are new to Docker, you can read about this great piece of technology here. First, you will need to install Docker on Manjaro 18.0. Once you have Docker on your computer, open Terminal and run this command to install MariaDB. 

sudo docker run --name mariadb01 -e MYSQL_ROOT_PASSWORD='12345' -p 33060:3306 -d mariadb

Note:

  • mariadb01 ==> Name of the container. Change it with something you like
  • 12345 ==> the root password for Mariadb. You need to change this value with your own password
  • 33060 ==> The port that is used by Mariadb. You can change it with other number. Or, leave the default value which is 3306

The command will download the latest mariadb docker image from the internet. 

Connect MySQL Workbench with the MariaDB Container

Open Workbench and then click the + symbol to add a new connection. 

Give it a new connection name. And then on the hostname, type 0.0.0.0 (if you connect it from the same host). If you connect from other computer, type the ip address of the Docker host. Enter other credentials such as port and password for root. Finally, hit Test Connection and make sure you can connect to it.

That’s it. We have learned how to install MariaDB Server on Manjaro 18.0 directly and via Docker Container. I hope you enjoy this tutorial, please share and see you on the next tutorial.

1 Comment

  1. Thanks alot for such a great tutorial! it made a good changes in my pc. looking forward to be notified in every new tool and tech. that will make my like more easier.

Leave a Reply