Install Mariadb in Aws Ec2

Nov 22, 2017 / Updated on Nov 22, 2017

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 https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | 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 https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version="mariadb-10.3"

sudo apt install mariadb-server

For NON LTS version

Goto this link: https://downloads.mariadb.org/mariadb/repositories

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 = 127.0.0.1

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

Ref: https://mariadb.com/kb/en/library/systemd/

Set UTF8 as default charset

Refer: https://yottabrain.org/database/mysql/mysql-mariadb-set-utf8mb4-as-default-charset/

Refer: https://yottabrain.org/database/mysql/mysql-mariadb-set-utf8mb4-as-default-charset/

References

comments powered by Disqus
Categories:
Tags: