MariaDB is a binary drop-in replacement for MySQL, developed by the original authors of MySQL Project and fully compatible with MySQL having more features and better performance enhancement.
Why should I Use MariaDB?
As we all know MySQL is widely used and the most popular RDBMS and the first choice of developers. In 2008, MySQL was acquired by Sun Microsystem, which was subsequently bought by Oracle and is no longer open source.
Well, MariaDB is sponsored by Monty Program AB & MariaDB Foundation and is independently developed by the core developer of MySQL and other community members, and is truly open source.
MySQL was created by Michael “Monty” Widenius, David Axmark, and Allan Larsson the founder of MySQL, and Monty Program AB is now behind MariaDB. They would oversee the development of the MariaDB foundation.
Who uses MariaDB?
There are a number of distributions & large websites that have switched to MariaDB, some of them are:
- Amazon Web Services
- Mozilla Corporation
- Wikipedia
- OpenSuse
- Fedora
- OLX
- Nimbuzz
- SlashGear
- ArchLinux
- Redhat Enterprise Linux (from RHEL7)
- Manjaro
- Mageia
- Debian
- The Chakra Project
- Gentoo
- OpenBSD
Installing MariaDB in RHEL-based Distributions
On RHEL-based distributions such as CentOS Stream, Rocky Linux, and AlmaLinux, it is strongly recommended to install the appropriate RPM packages from AppStream’s repository using yum or dnf as shown.
# yum install mariadb-server mariadb-backup mariadb-common OR # dnf install mariadb-server mariadb-backup mariadb-common
Once the installation is complete, you can start, enable and verify the status of the MariaDB service with:
# systemctl start mariadb # systemctl enable mariadb # systemctl status mariadb
Once the MariaDB service is started, it is time to enhance its security by setting a root password, removing anonymous users, disabling remote root login, removing the test database, and reloading privilege.
# mysql_secure_installation
It is noted that the root password is empty, so if you want to set it, simply press “enter”, when prompted and set the root password. For the rest you can follow the steps and answers on the image below:
Once the MariaDB is secured, it is time to connect to the mysql shell as shown.
# mysql -u root -p
When prompted, enter the root password that you set earlier.
Installing MariaDB in Debian-based Distributions
On Debian-based distributions such as Ubuntu and other similar Linux distributions, it is strongly recommended to install the appropriate DEB packages from MariaDB’s repository using the apt package manager.
# apt install mariadb-server mariadb-backup mariadb-common Or $ sudo apt install mariadb-server mariadb-backup mariadb-common
Once the installation is complete, you can start, enable and verify the status of the MariaDB service with:
# systemctl start mariadb # systemctl enable mariadb # systemctl status mariadb
Once the MariaDB service is started, it is time to enhance its security by setting a root password, removing anonymous users, disabling remote root login, removing the test database, and reloading privilege.
# mysql_secure_installation
Login to MariaDB with the root credential which was set earlier.
$ sudo mysql -u root -p [sudo] password for narad: Enter password:
Type quit from the command prompt to exit from the database.
The mirror http://mirrors.scie.in/mariadb/repo/5.5 was mentioned for installing the MariaDB on debian and ubuntu is no more possible. Is there any alternative mirrors?
@Sajjad,
Sorry for trouble, we will check and update the article to most recent MariaDB version.
When is this update going to be done?????
@Kevin,
Hopefully by this weekend this is going to update to latest MariaDB, sorry for trouble..
Please do the followings:-
1. Stop MariaDB
2. Copy the existing data directory i.e. /var/lib/mysql (default location) to new location
3. Edit the MariaDB configuration file.
4. Search entry for datadir or create the new one as below.
datadir = /newpath
5. Restart mariadb service.
What abt The latest version can that be installed?
Yes you can, but I need to update this article to support latest stable version installation.
My installation is centos 6.5 and MariaDB 10.07
I use mariadb over a year on my notebook (fedora 19, and currently mariadb 5.5). On the notebook I changes the data directory to /home/db/mariadb by changing in /etc/my.cnf datadir=/var/lib/mysql to datadir=/home/db/mariadb. After restart of mysqld it works fine and all my data resides in that directory.
In the instant case /etc/my.cnf does not contain any data. Likewise the sample cnf file do not have an entry for datadir. Once the parameter datadir is entered the server starts but complains, in my case, on write error due to inability to access /var/lib/mysql/[my server name].pid.
Can you please suggest how to change datadir on Centos 6.5 with MariaDB 10.07. If I live the deafault of /var/lib/mysql, every thing works fine.
Narad, any thoughts on trying to run this on s390x architecture ?
PS: you dont need a real IBM mainframe to port, you can use Hecules ie: http://fedoraproject.org/wiki/Architectures/s390x
i got this error after replacing default installed MariaDB to MYSQL in my Fedora 19
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
I tried installing MariaDB again but i still got the error (after removing mysql server)
Check your mysql daemon is running if not start with below command.
Start the mysqld daemon.
# systemctl start mysqld
To enable mysql daemon to start at boot
# systemctl enable mysqld.service