How To Install MySQL On Ubuntu, Debian, Mint Kali – POFTUT

How To Install MySQL On Ubuntu, Debian, Mint Kali

MySQL is free and opensource database server which is very popular in opensource community. MySQL is used by alot of applications and companies like Facebook, Google etc. In this tutorial we will learn how to install MySQL into deb or apt based distributions like Ubuntu, Debian, Mint and Kali. This guide can be used for other deb or apt based distributions too.

Update Repository Information

It is not a reuirement but a best practice to update repository information which will provide us the newest information about MySQL.

Update Repository Information

Update Repository Information

Install MySQL Server From Apt Repository

MySQL Server application is named as mysql-server as package name. We can use apt or apt-get in order to install mysql-server package like below. We can also use -y option in order to automatically accept conformation.

Install MySQL Server From Apt Repository

Install MySQL Server From Apt Repository

Download MySQL Server Binary

Another way to install MySQL is from binary installation file. We can download MySQL binary from official download site mysql.com . But keep in mind that different versions of MySQL Server is provided with different licenses and costs. We will use community version for Ubuntu which can be listed from following link.

https://dev.mysql.com/downloads/mysql/

and we will download the deb package with wget.

Download MySQL Server Binary

Download MySQL Server Binary

Install MySQL Binary Deb Package

After the download is completed we will first extract the tar archive like below.

Install MySQL Binary Deb Package

Install MySQL Binary Deb Package

and we will install the mysql-community-server_8.0.11-1ubuntu18.04_amd64.deb  package with dpkg like below.

Secure MySQL Installation

Security is important part of the today IT systems. We can make MySQL more secure by using mysql_secure_installation  hardening script. This will run some commands which will change MySQL configuration and harden it.

LEARN MORE  How To List MySQL Tables with "show tables" SQL Query

This script will start by asking root password and then ask some questions about security.

Secure MySQL Installation

Secure MySQL Installation

Show MySQL Service or Daemon Status

After the installation is completed and secured we can list the status of the MySQL server. We will use systemctl command with status option to list whether the MySQL daemon is working or not.

Show MySQL Service or Daemon Status

Show MySQL Service or Daemon Status

As we can see the daemon is running properly.

Start MySQL Service or Daemon

If the MySQL service is not started or stoped with a reason we can start MySQL service with start option like below.

Stop MySQL Service or Daemon

If we need to stop the MySQL daemon we can use stop option. This can be useful to apply new configuration by stopping and starting the service.

Test MySQL Server

We can test MySQL server by connecting to the service console with mysql command. We also need to provide the username and the password like below.

Test MySQL Server

Test MySQL Server

Leave a Reply

Your email address will not be published. Required fields are marked *

Enjoy this blog? Please spread the word :)