How To Install MariaDB on Ubuntu 18.04 / Ubuntu 16.04

MariaDB is a fork of the very popular MySQL database management system, and it is now considered as a full drop-in replacement for MySQL.

Install MariaDB on Ubuntu 18.04 / Ubuntu 16.04

You can install MariaDB in two ways, using either Ubuntu repository or Official MariaDB mirror.

  1. Install MariaDB from Official MariaDB mirror
  2. Install MariaDB from Ubuntu Repository

Important Notes

Ubuntu 18.04 includes MariaDB 10.1 which the latest version for Ubuntu 18.04 in its main repository. So, we recommend using Ubuntu repository for MariaDB installation on Ubuntu 18.04

We recommend not installing MariaDB from Ubuntu repository on Ubuntu 16.04 as the version available in it is MariaDB 10.0 which is already the end of support.

Install MariaDB from Official MariaDB Mirror

MariaDB offers an official installer package for MariaDB v10.4. You can choose any one of the mirrors from the MariaDB downloads page to download it.

sudo apt-get update

sudo apt-get install -y software-properties-common apt-transport-https ca-certificates

Add public signing key to your system.

sudo apt-key adv --fetch-keys 'http://mariadb.org/mariadb_release_signing_key.asc'

Use the add-apt-repository command to add MariaDB repository straight away.

### Ubuntu 18.04 ###

sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.4/ubuntu bionic main'

### Ubuntu 16.04 ###

sudo add-apt-repository 'deb [arch=amd64,arm64,i386,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.4/ubuntu xenial main'

Now, install MariaDB using the following command.

sudo apt-get update

sudo apt-get install -y mariadb-server mariadb-client

Use mysql_secure_installation to secure the installation of the MariaDB server.

Install MariaDB from Ubuntu Repository

Installing from the Ubuntu default repository is a straightforward way, but this may have a bit old version of MariaDB.

sudo apt-get update

sudo apt-get install -y mariadb-server mariadb-client

Use mysql_secure_installation to secure the installation of the MariaDB server.

Perform the below steps only when you need to access MariaDB as MariaDB root user from external machines or other Unix logins, otherwise, skip below.

Login as MariaDB root user.

$ sudo mysql -u root -p
No password required
use mysql;
update user set plugin='mysql_native_password' where user='root';
flush privileges; 
quit;

Now you can log in as the MariaDB root user without any problem.

Access MariaDB

To access the MariaDB instance, run the following command on the terminal.

sudo mysql -u root -p

Enter the password of the root user that you have set during the installation.

Once after entering the password, you would get the MariaDB shell.

MariaDB Shell

Control MariaDB service

In case if you want to start/stop the MariaDB, you can use the following command.

sudo systemctl start mariadb

sudo systemctl stop mariadb

Conclusion

That’s All. Please share your feedback in the comments section.

databasemariadbmysqlubuntu 16.04ubuntu 18.04
Comments (3)
Add Comment
  • 增达信购QQ172607715

    增达信购:边看美女边赚钱,什么不干,坐收百万

    会员权益:

    ①:十级提成自动拿,逆向网赚,不用拉人,坐等收钱

    ②:百万套图打包下,高清无码,永久更新,每日增加

    ③:无限广告任意发,赠送网站,独立域名,极速空间

    【免费注册,立奖一元,网址:】

    http://www.172607715.3i4.com.cn/

  • QQ403867

    增达信购:最嚣张逆向直销网赚,边看美女边赚钱

    会员权益:

    ①:静态分红,每天签到,就有钱赚,高达百元

    ②:十级提成,逆向网赚,不用推广,坐等收钱

    ③:百万套图,高清无水,永久更新,每日增加

    ④:无限广告,赠送网站,独立域名,极速空间

    我每日群发上万,做我下线,什么不干,坐等收钱:

    http://www.403867.3i4.com.cn/

    联系QQ:403867

  • JH

    Thanks! It’s been very helpful.