The Complete Magazine on Open Source

MariaDB: The Community-Developed Fork of MySQL

, / 289 0

Database 3d

MariaDB is a community-developed fork of the MySQL relational database management system and is guaranteed to remain free. This article targets application developers who use an RDBMS day in and day out, and any technology enthusiast who loves to know about new technologies, especially in the open source world.

Whether you are a well-established professional from the computer applications world, or a budding computer science student, you are probably familiar with MariaDB, the new entrant in in the world of RDBMS. So let’s try to define MariaDB. When you read about it, you actually find various people defining it differently.
So I thought of defining it from two perspectives:

  • Historical definition: Specifying the origin and history behind it
  • Technical definition: Specifying what its technical capabilities are for users and developers

Historically, MariaDB is a fork of MySQL, the world’s most well-known RDBMS. MariaDB was started by the founder of MySQL (Monty Widenius) in 2009, with the intention of keeping it open source and improving community contribution, which went down notably after the multiple acquisitions of MySQL — first by Sun Microsystems and then by Oracle.
Technically, MariaDB is a fork/branch of MySQL that provides backward compatibility and drop-in replacement for MySQL, with a better and more enhanced set of features compared to the equivalent MySQL release.

Scope and special features of MariaDB
Monty Widenius started MariaDB with a very specific mandate:

  • Import all new code from the MySQL branch and then enhance it to make it more stable
  • Clean up MySQL code
  • Add and encourage more community contributions
  • Develop its own storage engine
  • Add more new features, including third party software

Where does one find MariaDB and how do we install it?
From 2015, MariaDB has been adopted by all major Linux distributions such as Ubuntu, SUSE, Red Hat and Debian in their software repositories. Apart from these, specific versions can be downloaded from the MariaDB download page and from all over the Internet.

Installing MariaDB
There are many ways to install MariaDB. If you have some distribution’s MariaDB repository configured, then you can use a distribution-specific installer; for example, for Red Hat or Fedora, you can use Yum, as follows:

$ yum install MariaDB MariaDB-server –y

And if you have downloaded the specific version in the .tar.gz format, then you can install and configure it as per your requirements. A few specific configurations that I have defined are listed here.

Standard installation:
a. Copy the tar file to /usr/local/mysql (the generic default location on most platforms)
b. Untar/unpack the distribution
c. Run the installer script ./sripts/mysql_install_db –user=mysql

Installing MariaDB as the root user: If you have root access, then you should install MariaDB with the user and group as ‘mysql’. This will also provide compatibility with MySQL. The installation steps are as follows:

$ groupadd mysql
$ useradd –g mysql mysql
$ cd /usr/local
$ tar -xvzf <MariaDB.tar.gz file>
$ cd mysql
$ ./scripts/mysql_insatll_db --user=mysql
$ chown –R root
$ chown –R mysql data

Replacing MySQL with MariaDB: It is very easy to replace an installed MySQL with MariaDB. You need not even run the mysql_install_db script, but just follow the steps shown below:
a. Stop the MySQL instance
b. MariaDB will find the path to your data directory from /etc/my.cnf
c. Start the MySQL daemon again from MariaDB:

$ ./bin/mysqld_safe --user=mysql &

Or specify the config file location:

$ ./bin/mysqld_safe –defaults-file=~/my.cnf –user=mysql &

And finally, modify the $PATH variable so that you can invoke binaries:

Export PATH=$PATH:/usr/local/mysql/bin/

Let’s try to experience MariaDB
Starting MariaDB: Starting MariaDB is as simple as starting any other service on any Linux box and the same as starting the MySQL service.
If you are still on an old init based system, then use the following command:

$/etc/init.d/mysql start

And if you are on a newer systemd based platform, then use the command given below:

$systemctl start mariadb.service
$systemctl enable mariadb.service - In order to start it during system boot

Logging in to MariaDB: Logging in to MariaDB is no different from what you have been doing with MySQL. Just type the mysql command and you will get the familiar MySQL CLI environment. Then all the world is yours.

A few features of MariaDB related to developers are listed below:

  • Open and free: Developed by the community under GPL. Hence no cost involved in royalties.
  • Support: MySQL itself has well-established documentation support, which can also be used for MariaDB. Apart from that, an adequate MariaDB-specific knowledge base is available on the Web.
  • Speed: MariaDB is regarded as one of the fastest databases available, faster even than MySQL.
  • Functionality: Provides support for all MySQL features along with additional new and enhanced features developed by the community.
  • Ease of use: According to user feedback, MariaDB is easy to use, especially with features like flexible syntax.
  • Portability: Provides easy ways to import/export CSV and XML, and is also portable with preinstalled MySQL.
  • Scalable: MariaDB as its parent is ideal for both small as well as large databases.
  • Plugins: Last but not the least, the most important feature of MariaDB is that it provides various storage engines and other third party plugins which cannot be added to MySQL.

Industry adoption
Having spoken so much about MariaDB, let’s look at how the industry has adopted it. Shown below is the list of a few RDBMS platforms that support MariaDB.

DataBase Workbench: This is a software application for development and administration of multiple relational databases.
DBEdit: This is a free administration application for MariaDB and other databases.

HeidiSQL: This is a free open source client for MySQL on Windows. It supports MariaDB-specific features with the Windows MSI package of MariaDB, beginning with the 5.2.7 release.

Navicat: This is a series of proprietary database management applications for Windows, Mac OS X, and Linux.

phpMyAdmin: This is a Web-based database management application for MySQL.
SQLyog: This is a database management application on Windows and Linux.
Here is a short list of applications that officially support MariaDB:

  • Drupal
  • Moodle
  • WordPress
  • ERP5
  • MONyog
  • Kajona

These, apart from many more, are a proof that MariaDB is accepted across the industry and is a force to reckon with in the world of RDBMS.

Developers’ section
As the article is about a new and rapidly developing RDBMS, it obviously opens up a sea of opportunities at every possible stage, for everyone to contribute and be a part of the change.
If you are an enthusiast, love the open source culture and, most importantly, want to make a name for yourself with some effort, given below are a few links that can help you do exactly that.