How to Install MySQL on Debian 9

Table of Contents
Install MySQL on Debian 9
MySQL is one of the most popular opensource database management systems. MySQL is a relational database system. It is part of LAMP (Linux, Apache, MySQL, PHP) stack and LEMP (Linux, Apache, MySQL, PHP) stack. In this tutorial, you are going to learn how to install MySQL on Debian 9.
Prerequisites
Before you start to install MySQL on Debian 9. You must have the root user account credentials of your system.
Install MySQL
Following are the steps to install MySQL on Debian. First, you need to update the package manager index and then you can install MySQL-Server on Debian.
Update the apt
package manager index by typing following command:
sudo apt update
Now to install mysql-server
package run below command:
sudo apt install mysql-server
Now confirm the installation and check MySQL version typing following command:
mysql -V
After completing installation MySQL will start automatically. Check MySQL version by typing:
sudo systemctl status mysql
The output should be:
● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2018-06-20 11:30:23 PDT; 5min ago Main PID: 17382 (mysqld) Tasks: 27 (limit: 2321) CGroup: /system.slice/mysql.service `-17382 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid
You can log in to MariaDB by typing
mysql -u root -p
Setting Up MySQL
After installation, we have to improve MySQL security by typing the following:
sudo mysql_secure_installation
The above command will take you to different prompts. In the first prompt, it will ask you to configure Validate Password Plugin
which is used to set password validation strength and the levels are low, medium and high. You can prefer any of the strength levels you want to set. If you don’t want to set up the Validate Password Plugin
just press ENTER
. In the next prompts, you will be asked questions about increasing Security of MySQL. It is recommended to answer ‘Y’ for all questions asked during secure installation.
Conclusion
You have successfully learned how to install MySQL on Debian 9. If you have any queries please don’t forget to comment out.
LATEST POSTS
-
How to install Audacity on Debian 9
-
How to Uninstall Programs from Ubuntu System
-
How to Install Go on Ubuntu 18.04
-
How to Install Sublime Text 3 on Debian 9
-
How to install Node.js with npm on Ubuntu 18.04
-
How to Install Laravel PHP Framework With Nginx on CentOS 8
-
How to Install LEMP Stack on Debian 9
-
How to Install Laravel PHP Framework With Nginx on CentOS 7
-
Best Ways to Check MySQL Version
-
How to Install Apache Tomcat 9 on Debian 10
-
How to Install WebStorm on Manjaro 18
-
How to Install Java on Debian 10