How to install MariaDB 10.2 in Ubuntu 16

by Daniel Pham
Published: Updated:

This article will show you how to install MariaDB 10.2 in Ubuntu 16.04.

MariaDB supports repository for operating systems based Redhat and Debian .

Add MariaDB repository

MariaDB has a page, allowing you to choose the repository that fits your OS.

You can access this link to get the configuration for Ubuntu 16.04.

Or you can follow the instructions below.

You run the following command to install and verify the key for the repository.

root@ubuntu16:~# apt-get install software-properties-common apt-transport-https -y
root@ubuntu16:~# apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8

Then, run the following command to add MariaDB’s repository to the machine’s APT tree.

root@ubuntu16:~# add-apt-repository 'deb [arch=amd64,arm64,i386,ppc64el] https://mirrors.shu.edu.cn/mariadb/repo/10.2/ubuntu xenial main'

Recommended Reading: How to install MariaDB 10.3 in CentOS 6

Install MariaDB 10.2

After adding the repository, you run the command to update the packages.

root@ubuntu16:~# apt update -y

And then type the following command to install the MariaDB server.

root@ubuntu16:~# apt install mariadb-server -y

During installation, it will ask you to set a password for MariaDB’s root user.

Configuring mariadb-server-10.2
-------------------------------

While not mandatory, it is highly recommended that you set a password for the MariaDB administrative "root" user.

If this field is left blank, the password will not be changed.

New password for the MariaDB "root" user:

You can set it now or later. You can also leave it blank.

The installation process may take several minutes.

install mariadb 10.2 in ubuntu 16.04
Install MariaDB 10.2 in Ubuntu 16.04.

Enable and use mariadb

Recommended Reading: How to install MariaDB 10.2 on CentOS 6

After the installation is completed, you can check the installed version with the following command.

root@ubuntu16:~# mysql -V
mysql Ver 15.1 Distrib 10.2.22-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Next, enable the mysql service.

root@ubuntu16:~# systemctl enable mysql

The results like this.

root@ubuntu16:~# systemctl enable mysql
mysql.service is not a native service, redirecting to systemd-sysv-install
Executing /lib/systemd/systemd-sysv-install enable mysql
insserv: warning: current start runlevel(s) (empty) of script `mysql' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `mysql' overrides LSB defaults (0 1 6).

And then start the service.

root@ubuntu16:~# systemctl start mysql

If you only allow access to local MariaDB, you don’t need to worry about firewalls.

If you want to allow remote access, you need to open port 3306 on the firewall.

Conclusion

Installing MariaDB on Ubuntu 16.04 is very easy. You just need to run a few lines of commands that are installed.

Installation is a story, using and optimizing MariaDB is another story.

(This is an article from my old blog that has been inactive for a long time, I don’t want to throw it away so I will keep it and hope it helps someone).

0 0 votes
Article Rating

You may also like

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

DevOps Lite is a personal blog specializing in technology with main topics about DevOps, DevSecOps, SRE and System Administrator. Articles are shared for free and contributed to the community.

SUPPORT US

FOLLOW US

Subscribe my Newsletter for new blog posts. Stay updated from your inbox!

© 2021-2024 DevOpsLite.com – All rights reserved.

Please write sources “DevOpsLite.com” when using articles from this website.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

0
Would love your thoughts, please comment.x
()
x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.