Thursday, December 3, 2020

Install MySQL on Debian 9 Operating System

Must read

How to Setup a Firewall with UFW on Debian 10 Linux

Nowadays, a Firewall is an essential utility and property of any system for security; by default Debian Operating system having a firewall...

How to Install Eclipse IDE on Debian 10 Linux

Eclipse is the most famous and widely used Java integrated development environment (IDE). It supports many plugins to enhance the capabilities to...

How to Install Ruby on Debian 10 Linux

Nowadays, Ruby is the most popular language, especially for SaaS application development. It has a perfect and elegant syntax structure, and it...

How to Install MongoDB on Debian 9 Linux

MongoDB is an open-source and free NoSQL document based database system. Nowadays, it is prevalent as most application developers are using MongoDB,...
SATISH KUMAR
I am Satish Kumar, Founder of LinuxConcept. Linux and F.O.S.S enthusiast, love to work on open source platform and technologies.
- Advertisement -

MySQL is the most popular and highly used Open source relational database management system; it is no more available with the default repository of Debian Operating system after releasing of version 9.

Now MariaDB has become the default database management system for new Debian Operating system, and it is backward compatible and perfect replacement of MySQL Database System.

- Advertisement -

In this tutorial, the article will show you how to install MySQL Server into the Debian 9 Operating system using MySQL APT Repository.

I suggest you if your application has specific requirement of MySQL database then only install MySQL server otherwise you can stick with MariaDB the default database management system in Debian 9.

Prerequisites

Before following the below steps to install MySQL, make sure you have Debian 9 installed a system with a user who has sudo privileges.

MySQL Installation

To install MySQL on Debian 9 machine, follow below procedure:

Step 1 – MySQL Repository Configuration

- Advertisement -

To install MySQL into Debian 9 Operating System, you need to add MySQL APT repository, to install the latest repository need to go to the MySQL repository download page and download the latest release package by using the following command:

$ wget http://repo.mysql.com/mysql-apt-config_0.8.13-1_all.deb

After completing the download, install the release package with the following command:

$ sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb

You will get the below configuration menu to select MySQL version you want to install.

- Advertisement -

MySQL 8.0 is pre-selected for this repository, if you want to install another version of MySQL, choose MySQL Server & Cluster (Currently selected: mysql-8.0) and select your preferred version of MySQL.

As we are going to install MySQL with version 8.0, Select the last option OK and press Enter to save the configuration.

Step 2 – MySQL Installation

To install MySQL on Debian 9 Operating system first update the repositories package list by using the following command:

$ sudo apt update

After updating the package, you can start the MySQL installation by using the following command:

$ sudo apt install mysql-server

The installation process will prompt you to enter the MySQL root password, don’t set password right now we will do it in next session.

Now, you will get a new screen for authentication plugin message for MySQL 8, before selecting the default MySQL 8 authentication to make sure your application is supporting it or not.

Step 3 – MySQL Verification

Once the MySQL installation process completed, the MySQL service will automatically start.

You can check the MySQL service status by using the following command:

$ sudo systemctl status mysql

Step 4 – Securing MySQL

To secure the MySQL database system run the mysql_secure_installation command, it will help you to set the root password and to improve newly installed MySQL security.

$ sudo mysql_secure_installation

The screen will have asked you to configure the VALIDATE PASSWORD PLUGIN, which is use to check the MySQL password strength. It defines the password policy validation in three levels low, medium, and strong. If you don’t want to set the validate password plugin press the Enter button.

Next screen will ask you to set the root password:

Once root password is set the script will ask you to remove the anonymous user, restrict root access to the localhost and remove test database, and you should answer Y (yes) for all the question to secure the MySQL.

Step 5 – Connect MySQL through CLI

To connect with MySQL server, you need to first login into the MySQL Server through Command-line interface by using the following command:

$ mysql –u root –p

Now you will get the screen to enter the root password which you had set when the mysql_secure_installation script was running.

After entering the password you will get into the MySQL shell, and your screen will like below image:

Conclusion

Now you learned the process to install MySQL server on Debian 9 Operating system. You also know how to get into the MySQL shell to perform database commands and operations.

- Advertisement -
- Advertisement -

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Subscribe to our newsletter

To be updated with all the latest news, offers and special announcements.

Latest article

How to Setup a Firewall with UFW on Debian 10 Linux

Nowadays, a Firewall is an essential utility and property of any system for security; by default Debian Operating system having a firewall...

How to Install Eclipse IDE on Debian 10 Linux

Eclipse is the most famous and widely used Java integrated development environment (IDE). It supports many plugins to enhance the capabilities to...

How to Install Ruby on Debian 10 Linux

Nowadays, Ruby is the most popular language, especially for SaaS application development. It has a perfect and elegant syntax structure, and it...

How to Install MongoDB on Debian 9 Linux

MongoDB is an open-source and free NoSQL document based database system. Nowadays, it is prevalent as most application developers are using MongoDB,...

How to Install Python 3 on Ubuntu 20.04 Linux

Python is one of the most popular and easy to code programming language nowadays, because of its simplicity and easy to code....