I like up to date software on my servers and you should too. CentOS installs an old version of MariaDB (5.5.52-MariaDB), in this guide we’ll be updating to 10.2-MariaDB instead.
Upgrading MariaDB is quite an easy task to do but you should take backups before doing anything. This guide assumes your CentOS 7 install is 64bit.
First lets check the version we’re currently running, you can do this by typing “mysql -v” into your terminal.
[[email protected] ~]# mysql -v Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 143 Server version: 5.5.52-MariaDB MariaDB Server
Adding the repository
To add the repository we’ll need to create a file and add some content to it.
Using nano, or whatever text editor you like to use, I don’t judge, add a new file.
sudo nano /etc/yum.repos.d/MariaDB.repo
and insert the following content, then save and exit.
# Used to install MariaDB 10 instead of default 5.5 # http://mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = https://yum.mariadb.org/10.2/centos7-amd64/ gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
Removing MariaDB 5.5
Now if you have MariaDB already installed you’ll need to uninstall it first, do this by running the following command. If you have data stored in the database then you should take backups before doing anything.
sudo yum remove mariadb mariadb-server
Installing MariaDB 10.2
Now we can update Yum’s package repositories, it sounds complicated but it’s really easy.
sudo yum update
Now we’ll reinstall MariaDB but with the newer version, some dependencies might also be installed.
sudo yum install mariadb mariadb-server
Now start MariaDB
sudo service mariadb start
Checking the version
After that we’ll check the installed version like we did at the start.
And now you should have an output saying the version is 10.2.x.
[[email protected] ~]# mysql -v Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 8 Server version: 10.2.7-MariaDB MariaDB Server
Enabling the Service
By default MariaDB won’t start on boot, meaning if your server reboots then your database wont come back online on its own. We’ll fix that by enabling it too.
systemctl start mariadb systemctl enable mariadb.service
And now we’re all done!
Upgrading your server to use PHP 7 or PHP 7.1 is another great way to improve your websites speed!
If you need any help leave a comment and I’ll see what I can do 🙂