Install Mariadb in Aws Ec2

These steps can be used install mariadb on any Ubuntu based Linux system (local desktop, aws ec2, etc.)

Install MariaDB

Execute the following commands:

curl -sS | sudo bash

sudo apt install mariadb-server

During this setup, it will ask for root password. Enter and keep a note of it.

Install a specific version

curl -sS | sudo bash -s -- --mariadb-server-version="mariadb-10.3"

sudo apt install mariadb-server

For NON LTS version

Goto this link:

Choose Ubuntu and version. Follow the instruction.

Setup MariaDB Client

sudo apt install mariadb-client

Verify Installation

Verify correct version installed by executing

 mysql --version

Login as root to check the installation

 mysql -u root -p

Enable Network access

To access the database from outside localhost comment the bind-address in in /etc/mysql/my.cnf

 sudo vi /etc/mysql/my.cnf

comment the line “bind-address” with # as follows

 # bind-address =

Restart MariaDB to enable this access

 sudo service mysql restart

Disable MySQL autostart

Execute this step, if you want MariaDB NOT automatically start during boot time.

sudo systemctl disable mariadb

and any time you can start MariaDB using

sudo service mariadb start

check status

sudo service mariadb status

To start the mariadb during boot time again

sudo systemctl enable mariadb


Set UTF8 as default charset