How To Install MySQL on Ubuntu Linux

Introduction

MySQL is a free database commonly install on many Virtual Private Server (VPS). It is a powerful database with many community support. MySQL is a popular open source relational database, it is use SQL language to operate.  Many MySQL installation power up Linux base web site to operate.

Prerequisites

We are going to install MySQL database in Linux machine particularly Ubuntu. in this tutorial I will show you how to install MySQL on Ubuntu version 14.04. To check Ubuntu version you have, follow steps below :

Open Ubuntu terminal, Run command : - lsb_release -a

 

Install MySQL on Ubuntu Linux

As you can see, we are going to cover installation of MySQL on Ubuntu linux version 14.04.  That doesn’t mean it wont work with another version of Ubuntu, however in this tutorial we just cover version 14.04. Let us update the package list from server.

sudo apt-get update

it will as for password. Enter root password.

  Install MySQL Server :

df -h

Open another terminal to check hard drive capacity, run df -h command. sudo apt-get install mysql-server

It will ask to continue installation after user answer “Yes”. Check your hard drive capacity before answer.

 

Input a Root MySQL password your choice when prompt. Remember this is MySQL

root password, not a root Ubuntu linux. Wait for the installation process to complete.

   

Hardening MySQL Installation

In this step we want to secure MySQL installation. You need a root account in this step. By default Ubuntu root account is lock. So, How are we going to use root privilege ? To gain a root privilege, run following command

sudo bash

Enter your user

[email protected]

sudo mysql_secure_installation

Enter MySQL root password to continue

You will prompt to pick a password validation policy. You can choose from Low, Medium or Strong Password.

if you choose a strong password policy, it may ask you to change root password. Next step you want to remove anonymous user. I personally answer yes for this question.

Next step you will prompt to disallow remote root login. I personally answer yes on this step.

Next step is to remove test database. MySQL initially load with test database. Answer Yes to this question.

Next step is Reload privilege tables. Answer Yes.

All Done.

Test MySQL installation

How do we know MySQL installed ?

service mysql status

Conclusion

You have a running MySQL installation running on Ubuntu Linux. if for some reason you want to remove the installation, we will cover on another posting.