So let’s get started with understanding what MariaDB is,
MariaDB is a popular, fast, scalable, and robust open-source database server developed by the developers of MySQL as an enhanced, drop-in replacement to the MySQL server. With a variety of plugins and tools to exaggerate its features and its widespread popularity, even large companies, such as Google, Wikipedia, and WordPress.com, are well-known users of MariaDB.
MariaDB is a mature, stable, open-source relational database fork from MySQL. Most Linux distributions have replaced MySQL with MariaDB as the default database server. MariaDB powers applications at companies and organizations, including Google, Wikipedia, Tencent, Verizon, Deutsche Bank, Huatai Securities and more.
MariaDB is an open-source relational database management system, commonly used as an alternative for MySQL as the database portion of the popular LAMP (Linux, Apache, MySQL, PHP/Python/Perl) stack. It is intended to be a drop-in replacement for MySQL.
MariaDB is a fork of the MySQL database management system. The RDBMS offers data processing capabilities for both small and enterprise tasks.
Here are the pros/benefits of using Maria DB.
● It operates under GPL, BSD, or LGPL licenses.
● MariaDB supports a popular and standard querying language.
● It comes with many storage engines, including high-performance ones that can be integrated with other relational database management systems.
● It offers advanced Galera cluster technology.
● MariaDB supports PHP, a popular language for web development.
History of MariaDB
● 5.1, GA released by MariaDB Foundation in February 2010
● November 2010 MariaDB 5.3
● February 2012 MariaDB 5.5
● April 2012 MariaDB Galera Cluster
● March 2013 MariaDB 10.0.10 (March 2014)
● MariaDB 10.1.8 (October 2015)
● Maria DB 10.2 8 April 2016
● Maria DB 10.3 16 April 2017
Features of Maria DB
Here are important features of Maria DB.
● Offers Backward Compatibility
● Open-source Software
● It is based on the MySQL Community Version
● New Storage Engine (PBXT, XtraDB, Maria, FederatedX)
● Percona Server (Based on MySQL Server, Other MySQL Fork Version)
Disadvantages of MariaDB
● The engine is still fairly new, so there’s no guarantee further updates and versions will be forthcoming.
● As with many other free database engines, you have to pay for support.
MariaDB has 12 new storage engines, whereas MySQL has fewer storage engines.
MariaDB has a larger connection pool supporting up to 200,000+ connections, whereas MySQL has a smaller connection pool.
MariaDB replication is faster, whereas MySQL replication is slower.
MariaDB is Open Source, whereas MySQL uses some proprietary code in its Enterprise Edition.
MariaDB doesn’t support Data Masking and Dynamic columns, while MySQL supports it.
Comparatively, MariaDB is faster than MySQL.
● A command-line/terminal window
● A user account with sudo privileges
● The apt package manager, included by default
Before you can install MariaDB 10.5, you may need to uninstall the current version of the MariaDB server. You can ignore this if upgrading. On Ubuntu, run:
sudo apt-get remove MariaDB-server
For CentOS 7, run:
sudo yum remove MariaDB-server
Install MariaDB 10.5 on Ubuntu 18.04
To install MariaDB 10.5 on Ubuntu 18.04, you need to add the MariaDB repository onto the system.
Step 1: Install software-properties-common if missing:
Install the software-properties-common package, which provides the add-apt-repository command:
sudo apt-get install software-properties-common
Step 2: Import MariaDB gpg key:
Run the command below to add Repository Key to the system
sudo apt-get install software-properties-common
sudo apt-key adv –fetch-keys ‘https://mariadb.org/mariadb_release_signing_key.asc
Step 3: Add the apt repository
Once the PGP key is imported, proceed to add repository URL to your Ubuntu 18.04 server:
sudo add-apt-repository ‘deb [arch=amd64,arm64,ppc64el] https://mariadb.mirror.liquidtelecom.com/repo/10.5/ubuntu bionic main’
Step 4: Install MariaDB
The last step is the installation of the MariaDB Server:
sudo apt update
sudo apt install MariaDB-server MariaDB-client
You will be prompted to provide a MariaDB root password. Enter a password to set.
install MariaDB 10.4 ubuntu 18.04 ubuntu 16.04 01
Press < OK> to confirm the new password and install MariaDB. Make sure you note the provided password.
If you were not prompted to set the root password, run:
$ sudo mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we’ll need the current
password for the root user. If you’ve just installed MariaDB, and
you haven’t set the root password yet, the password will be blank,
so you should press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on…
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorization.
Set root password? [Y/n] y
Re-enter new password:
Password updated successfully!
Reloading privilege tables…
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing and to make the installation
go a bit smoother. You should remove them before moving into a
Remove anonymous users? [Y/n] y
Normally, root should only be allowed to connect from ‘localhost. This
ensures that someone cannot guess the root password from the network.
Disallow root login remotely? [Y/n] y
By default, MariaDB comes with a database named ‘test’ that anyone can
access. This is also intended only for testing and should be removed
before moving into a production environment.
Remove the test database and access it? [Y/n] y
– Dropping test database…
– Removing privileges on the test database…
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
All done! If you’ve completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
Confirm MariaDB version:
$ MySQL -u root -p
Welcome to the MariaDB monitor. Commands end with; or \g.
Your MariaDB connection id is 49
Server version: 10.4.6-MariaDB-1:10.4.6+maria~bionic-log mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
Check the version using the command.
MariaDB [(none)]> SELECT VERSION();
| version() |
| 10.4.6-MariaDB-1:10.4.6+maria~bionic-log |
1 row in set (0.000 sec)
Run the Post Installation Script
To secure the MariaDB server as much as possible, run the post-installation script.
MariaDB 10.04 uses the unix_socket authentication plugin, so the MariaDB root user doesn’t need a password; when the script asks you to enter the password for root, just press Enter. Answer “n” to the next two questions.
MariaDB 10.4 ubuntu 18.04
Then you can press Enter to answer all remaining questions, which will remove anonymous users, disable remote root login and remove the test database. This step is a basic requirement for MariaDB database security. (Notice that Y is capitalized, which means it is the default answer. )
MariaDB ubuntu 18.10
Note: This troubleshooting tip no longer applies to MariaDB 10.4, which now uses the unix_socket authentication plugin by default. However, you might find it useful if you are still using MariaDB 10.3.
If you previously installed MariaDB from the default Ubuntu repository and now you install the latest MariaDB from mariadb.org, then you will probably encounter the following error when trying to login.
ERROR 1524 (HY000): Plugin’ unix_socket’ is not loaded
This is because the MariaDB.org binary still uses the mysql_native_password plugin to authenticate user login, whereas the MariaDB binary from the Ubuntu repository uses the unix_socket plugin to authenticate user login. The former requires the user to enter a password, whereas the latter allows the user to run the following command to log in without having to provide a MariaDB root password.
sudo MySQL -u root
Originally MariaDB root user is set to use the unix_socket to login because it’s installed from the Ubuntu repository, but now you install a new binary from mariadb.org, which disables the unix_socket plugin so that you will see the above error.
If you would like to continue to use the unix_socket method, then edit the 50-server.conf file.
sudo nano /etc/mysql/mariadb.cnf.d/50-server.cnf
Add the following line in the [mariadb] unit at the bottom.
plugin_load_add = auth_socket
Save and close the file. Then restart the MariaDB server for the change to take effect.
sudo systemctl restart mariadb
There are two other differences worth mentioning.
The MariaDB package from Ubuntu repository uses the /etc/mysql/mariadb.conf.d/50-server.conf file for server configuration, whereas the MariaDB package from MariaDB.org repository uses the /etc/mysql/my.cnf file for server configuration on clean install.
The MariaDB package from the mariadb.org repository will create a Debian-sys-maint user in the database, whereas the MariaDB packages from the Ubuntu repository won’t create this user. The password for this user is stored in /etc/mysql/debian.cnf file.
If you see the following error while running the sudo systemctl status MariaDB command.
ERROR 1045 (28000): Access denied for user ‘debian-sys-maint’@’localhost’ (using password: YES)
You may need to reconfigure the MariaDB-server-10.3 package with the following command.
sudo dpkg-reconfigure mariadb-server-10.3
When the reconfigurable wizard asks you to enter a new root password, you can press the Tab key and press Enter so that the root password won’t be changed.
Installing MariaDB on Ubuntu 20.04
Follow the steps provided in the following process to install the MariaDB server on your Ubuntu 20.04 system:
Open the terminal in Ubuntu using the Ctrl+Alt+T shortcut.
Use the following command to update the list of all packages in the system:
$ sudo apt update
All packages are updated. To begin the installation process, issue the following command:
$ sudo apt install mariadb-server
After completing the installation process, check the status of the database server with the following command:
$ sudo systemctl status mariadb
As you can see, the green mark is visible, and the current status is active in my system. If the status is disabled for some reason, use the command given below to activate the status:
$ sudo systemctl enable mariadb
Execute the following command to check the version of the MariaDB server:
$ mysql –V
For secure installation of the MariaDB server, use the following command:
$ sudo mysql_secure_installation
By following these steps, you have successfully installed the latest version of MariaDB on Ubuntu. We have also significantly improved database security levels by editing the default settings.
Most importantly, you have gained valuable insight and practice that will allow you to perform similar tasks more easily in the future.
MariaDB is a server developed by the developers of MySQL with versatile properties of plugins and tools. This article provided a brief introduction to the MariaDB server and the steps needed to install the server on Ubuntu 20.04.