MariaDB is a famous MySQL community fork that gained lots of popularity after Oracle acquisition of the MySQL project.
Website:- https://downloads.mariadb.org/mariadb/+releases/
In this tutorial we are going to show you how to upgrade MariaDB 5.5 to MariaDB 10.4.8 latest stable version. You will need to have root access to the machine, where you will be performing the upgrade.
For example MariaDB 5.1 -> 5.5 -> 10.4.8
1. Backup or Dump All MariaDB Databases
As always when performing an upgrade creating backup of your existing databases is important.
You can either dump the databases with command such:
Step1:- mysqldump -u root -ppassword --all-databases > /tmp/all-database.sql
Or alternatively, you can stop the MariaDB service with:
Step2:- systemctl stop mysql
And copy the databases directory in a separate folder like this:
Step3:- cp -a /var/lib/mysql/ /var/lib/mysql.bak
In case of failure of the upgrade you can use one of the above copies to restore your databases.
2. Add the MariaDB Repositorypackages are up to date
Step4:- yum update [Redhat Linux, CentOS & Fedora]
Step5:- apt-get update [Ubuntu, Linux Mint & Debian ]
On Redhat Linux, CentOS & Fedora
Step6:- vim /etc/yum.repos.d/MariaDB10.repo
Add the following text in it:
# MariaDB 10.1 CentOS repository list - created 2016-01-18 09:58 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
On Ubuntu, Linux Mint & Debian
Run the following series of commands to add the MariaDB PPA on your system:
Step7:- apt-get install software-properties-common
Step8:- apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:800xcbcb082a1bb943db
Step9:- add-apt-repository 'deb [arch=amd64,i386] http://kartolo.sby.datautama.net.id/mariadb/repo/10.1/ubuntu wily main'
Important: Don’t forget to replace the ubuntu wily with your distribution name and release.
3. Remove MariaDB 5.5
Step10:- yum remove mariadb-server mariadb mariadb-libs [On On Redhat Linux, CentOS & Fedora]
Step11:- apt-get purge mariadb-server mariadb mariadb-libs [On Ubuntu, Linux Mint & Debian]
Next, clean the repository cache:
Step12:- yum clean all [On Redhat Linux, CentOS & Fedora]
Step13:- apt-get clean all [On Ubuntu, Linux Mint & Debian]
4. Installing MariaDB 10.4.8
Now it’s time to install the newer version of MariaDB, by using:
Step14:- yum -y install MariaDB-server MariaDB-client [On Redhat Linux, CentOS & Fedora]
Step15:- apt-get install mariadb-server MariaDB-client [On Ubuntu, Linux Mint & Debian]
Start the MariaDB service
Step16:- systemctl start mariadb
MariaDB to automatically start after system boot
Step17:- systemctl enable mariadb
Finally run the upgrade command to upgrade MariaDB
Step18:- mysql_upgrade
To verify that the upgrade was successful
Step19:- mysql -V
Add the following text in it:
# MariaDB 10.1 CentOS repository list - created 2016-01-18 09:58 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
On Ubuntu, Linux Mint & Debian
Run the following series of commands to add the MariaDB PPA on your system:
Step7:- apt-get install software-properties-common
Step8:- apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:800xcbcb082a1bb943db
Step9:- add-apt-repository 'deb [arch=amd64,i386] http://kartolo.sby.datautama.net.id/mariadb/repo/10.1/ubuntu wily main'
Important: Don’t forget to replace the ubuntu wily with your distribution name and release.
3. Remove MariaDB 5.5
Step10:- yum remove mariadb-server mariadb mariadb-libs [On On Redhat Linux, CentOS & Fedora]
Step11:- apt-get purge mariadb-server mariadb mariadb-libs [On Ubuntu, Linux Mint & Debian]
Next, clean the repository cache:
Step12:- yum clean all [On Redhat Linux, CentOS & Fedora]
Step13:- apt-get clean all [On Ubuntu, Linux Mint & Debian]
4. Installing MariaDB 10.4.8
Now it’s time to install the newer version of MariaDB, by using:
Step14:- yum -y install MariaDB-server MariaDB-client [On Redhat Linux, CentOS & Fedora]
Step15:- apt-get install mariadb-server MariaDB-client [On Ubuntu, Linux Mint & Debian]
Start the MariaDB service
Step16:- systemctl start mariadb
MariaDB to automatically start after system boot
Step17:- systemctl enable mariadb
Finally run the upgrade command to upgrade MariaDB
Step18:- mysql_upgrade
To verify that the upgrade was successful
Step19:- mysql -V