Mariadb installation on Amazon linux 2

Viewed 8163

Can someone provide steps to install mariadb on amazon linux 2? I am pretty new in linux, so a little detail will be greatly appreciated. I have seen few links to install maria db on centOs but not sure if the same works for Amazon linux 2

2 Answers

If you use sudo yum install mariadb You'll get MariaDB version 5.5 which is an older version of MariaDB to get the latest version you will need to do the following.

  1. sudo amazon-linux-extras enable lamp-mariadb10.2-php7.2=latest
  2. sudo yum install mariadb mariadb-server

Note This will not work if you have php >= 7.3. If this is the case you must uninstall php before doing the steps above, using sudo yum erase php-common

  1. sudo amazon-linux-extras disable lamp-mariadb10.2-php7.2=latest

Now mariadb is installed. I first tried to add centos 7 repo, but wasn't successful in getting it to install correctly.

Here you go:

  1. Install and Start MariaDB
sudo yum update -y
sudo yum install -y mariadb-server
sudo systemctl start mariadb
sudo systemctl enable mariadb
  1. Secure DB server. Select the relevant option's during command run.
sudo mysql_secure_installation

But I recommend you to install MariaDB from official repo for latest version by following instructions in this link.

Related