MariaDB is one of the leading database servers across the globe. MariaDB aims to stay free and open source for users to benefit. Today, industry leaders such as Auto Europe, CCV, Samsung, NOKIA, Red Hat, Walgreens, Verizon, etc. leverage MariaDB to enhance their workloads and boost efficiencies.
MariaDB supports ACID style data processing and converts data into a structured form for an extensive range of applications. It ensures to retain data isolation, reliability, stability and atomicity for transactions.
MariaDB was originally developed in October 2009 as an improved, drop in fork for MySQL. It is scalable, fast and a highly robust solution comprising rich storage engines, powerful plugins and various other tools to suit users. It was designed with an objective to make sure the MySQL code base remains free forever.
MariaDB is an open source relational database management system (DBMS) that offers an SQL interface for users to access data. Its latest release has JSON/GIS features, Temporal Data Tables, Oracle Database compatibility features and advanced MariaDB clustering with Galera Cluster 4 as well. Some of the main highlights of MariaDB include parallel data replication, rich reams of storage engines including Cassandra, Aria, Spider, InnoDB, TokuDB, MyRocks and MariaDB ColumnStore.
Majority of the development of MariaDB aims to bridge the gap between features of MySQL and MariaDB. Most users can easily migrate to MariaDB by simply uninstalling MySQL to replace it with MariaDB installation. Most cloud storage providers include MariaDB and most Linux distributions also have it by default.
MariaDB embraces a versatile approach to keep up with the fluctuating database needs of today’s world. It has exclusively built, pluggable storage engines that easily work with processes without the need of a specialized database.
Enterprises can simply use one all inclusive, powerful database for their business specific needs, be it in the cloud or on prem. Deploy MariaDB within minutes to achieve unparalleled operational agility along with full SQL and ACID compliance. It is ideal for various hybrid cloud, analytical and transactional use cases.
Mariadb Pros
Open source.
MariaDB hosting is available at an affordable price, along with good documentation and online support portals.
Works ideally for a CMS to publish large volumes of content without the need to set it up.
Enables to write enquiries to the database direct or work in the source code of the website for seamless content publications.
By default, the latest version of MariaDB is not included in the Debian 11 default repository. So it is recommended to add the MariaDB official repository to get the latest MariaDB version.
First, install all the required dependencies using the command given below:
# [info] Skipping OS detection and using OS type 'debian' and version 'buster' as given on the command line
# [info] Checking for script prerequisites.
# [info] MariaDB Server version 10.6 is valid
# [info] Repository file successfully written to /etc/apt/sources.list.d/mariadb.list
# [info] Adding trusted package signing keys...
# [info] Running apt-get update...
# [info] Done adding trusted package signing keys
Next, download and install other dependencies using the following command:
At this point, the MariaDB repository is up to date. You can now install the latest version of the MariaDB server and client package by running the following command:
apt-get install mariadb-server mariadb-client -y
Once both packages are installed, start the MariaDB service and enable it to start at system reboot:
systemctl start mariadb
systemctl enable mariadb
Next, you can verify the MariaDB installed version with the following command:
mysqladmin version
You should get the MariaDB version in the following output:
mysqladmin Ver 9.1 Distrib 10.6.7-MariaDB, for debian-linux-gnu on x86_64
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Server version 10.6.7-MariaDB-1:10.6.7+maria~buster
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /run/mysqld/mysqld.sock
Uptime: 15 sec
Threads: 1 Questions: 58 Slow queries: 0 Opens: 33 Open tables: 26 Queries per second avg: 3.866
You can also verify the MariaDB listening port with the following command:
ss -antpl | grep mariadb
You should see the MariaDB listening port in the following output:
By default, the Mariadb installation is not secured. So I would recommend to secure it using the mysql_secure_installation script:
mysql_secure_installation
You will be asked to provide your current MariaDB root password if you have set:
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
haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none):
If you have not set any password then just press Enter to continue. You will be asked to switch to the unix socket authentication method:
OK, successfully used password, moving on...
Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] n
Type n and hit Enter to skip it. You will be asked to change the MariaDB root password:
... skipping.
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] Y
New password:
Re-enter new password:
Set your MariaDB root password and press Enter. You will be asked to remove anonymous users.
Password updated successfully!
Reloading privilege tables..
... Success!
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
production environment.
Remove anonymous users? [Y/n] Y
Type Y and press Enter. You will be asked to disallow root login remotely:
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
Type Y and press Enter. You will be asked to remove the test database:
... Success!
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 test database and access to it? [Y/n] Y
Type Y and press Enter. You will be asked reload the privilege tables:
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
Type Y and press Enter. Once the MariaDB is secured, you should get the following output:
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
With this article about how to Install Mariadb on Debian 11 Server let’s move onto creating Maradb database and table.
MariaDB comes with a mysqldump command line utility that allows you to easily backup and restores your database and tables in the event of database corruption or system failure.
To back up a database named authors and create a backup file named authors.dump, run the following command:
mysqldump -u root -p authors > authors.dump
To back up all databases, run the following command:
To restore a backup from the authors.dump backup file, run the following command:
mysql -u root -p authors < authors.dump
To restore all databases, run the following command:
mysql -u root -p < alldb_back.dump
Remove MariaDB Database
If you want to remove the MariaDB database from your server, run the following command:
apt-get remove mariadb-server --purge
After removing the MariaDB database, some other unwanted dependencies are still persist in your system. You can remove them by running the following command:
apt-get autoremove
Next, remove all package cache with the following command:
How to Install Mariadb on Debian 11 Server Conclusion
In this post, you learned how to Install Mariadb on Debian 11 Server. I hope you can now easily create a database, tables, insert data into a table and use it with your web applications.
I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.