Advance

How to install MySQL on Debian 10

How to install MySQL on Debian 10
0
(0)

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:

Recommended Article: How to fix EPEL Repository Error at CentOS 7

 

How to install MySQL on 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  

The filename list should be displayed.

Output
mysql-apt-config_0.8.13-1_all.deb  . . .

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.

 

Buy Linux Web Hosting

 

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  
mysql.service - MySQL Community Server     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)     Active: active (running) since Thu 2019-07-25 17:20:12 UTC; 3s ago       Docs: man:mysqld(8)             http://dev.mysql.com/doc/refman/en/using-systemd.html    Process: 2673 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (code=exited, status=0/SUCCESS)   Main PID: 2709 (mysqld)     Status: "Server is operational"      Tasks: 39 (limit: 4915)     Memory: 378.4M     CGroup: /system.slice/mysql.service             └─2709 /usr/sbin/mysqld    Jul 25 17:20:10 sammy systemd[1]: Starting MySQL Community Server...  Jul 25 17:20:12 sammy systemd[1]: Started MySQL Community Server.    

When the Active: active (running) line appears, you can make sure of MySQL installation and running.

 

Suggested to read

Tutorial installing MySQL on Ubuntu 20

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

If you receive the following output, you can make sure of MySQL server running.

Output
mysqladmin  Ver 8.0.17 for Linux on x86_64 (MySQL Community Server - GPL)  Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.    Oracle is a registered trademark of Oracle Corporation and/or its  affiliates. Other names may be trademarks of their respective  owners.    Server version      8.0.17  Protocol version    10  Connection      Localhost via UNIX socket  UNIX socket     /var/run/mysqld/mysqld.sock  Uptime:         3 min 9 sec    Threads: 2  Questions: 10  Slow queries: 0  Opens: 128  Flush tables: 3  Open tables: 48  Queries per second avg: 0.052

 

In conclusion, the above output confirms that you have successfully installed and secured the latest MySQL server which should work for many popular applications.

 

Dear user, we wish this tutorial would be helpful for you, to ask any question or review the conversation of our users about this article, please visit Ask page. Also to improve your knowledge, there are so many useful tutorials ready for Eldernode training.

 

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

View More Posts
Marilyn Bisson
Content Writer
Eldernode Writer
We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

Leave a Reply

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

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way

+8595670151

7 days a week, 24 hours a day