We are back with a new tutorial installation, In this article, you will learn how to install MySQL on Debian 10. MySQL is an open-source database management system that users would store and retrieve data for a wide variety of applications. As you guess, MySQL is the M in the LAMP stack. In the following, you will see the installation of the latest version of MySQL, you will add this repository, install the MySQL software itself, secure the install, and finally, you will test that MySQL is running and responding to commands.
Prerequisites
The tutorial may be more useful if you know:
- a non-root user with sudo privileges
- To set up, follow our Initial Setup with Debian 10
Table of Contents
4 Steps to Setup MySQL in Debian 10
1- Adding the MySQL Software Repository
To handle configuration and install the MySQL software repositories, you may use the .deb package. After setting up the repositories, you will be able to use Debian’s standard apt command to install the software.
sudo apt update
Then you need to install the prerequisite GnuPG package.
sudo apt install gnupg
apt will install GnuPG and its dependencies after confirming the installation. Then you should download the MySQL .deb package with wget and then install it using the dpkg command. After downloading the file using wget, remember to paste the address you just copied in place of the highlighted portion below:
cd /tmp
wget https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb
List the files to make sure the file has been downloaded in your current directory.
ls
Then, you can install it.
sudo dpkg -i mysql-apt-config*
to make the new software packages available, refresh your apt package cache as the package will now finish adding the repository.
sudo apt update
After adding the MySQL repositories, you are ready to install the actual MySQL server software. You can run sudo dpkg-reconfigure mysql-apt-config to update the configuration of these repositories. To refresh your package cache, just select a new option and then sudo apt-get update.
2- Installing MySQL
To install the latest MySQL server package, you can now use apt.
sudo apt install mysql-server
What the apt do, is to look at all available mysql-server packages and determine that the MySQL provided the package is the newest and best candidate. Type y and then ENTER to install the software. During the configuration phase of the installation, you will be asked to set a root password. Be sure to choose a secure password to continue.
To check MySQL installation and running, type below command.
sudo systemctl status mysql
When the Active: active (running) line appears, you can make sure of MySQL installation and running.
3- Securing MySQL
To perform a few security-related updates on our new install, you can run the following command.
mysql_secure_installation
4- Testing MySQL
To connect to the server and output some version and status information, type:
mysqladmin -u root -p version
Conclusion
Congratulations! You have completed the MySQL installation on your Debian 10 platform successfully. You can now utilize MySQL to create and manipulate databases and execute queries on your server.
The process of installing the MySQL database management system on your Debian 10 is quite an easy task which can be achieved in a few steps. Most of the time the MySQL server setup process will be very straight forward.