How to install MySQL on Debian 10 (Buster) Linux

How to install MySQL on Debian 10 (Buster) Linux

To date, Debian Buster is the latest version of the Debian operating system. Also known as Debian 10. Newer versions of Debian in its default repository using MariaDB. Now, this tutorial will help you install MySQL 8 or MySQL 5.7 on Debian 10 (Buster) Linux system.

Step 1 - a necessary condition

Log Debian 10 systems using shell access. For remote system, use SSH connection. Windows users can use Putty or other alternative applications SSH connection.

ssh root@debian10

Run the following command to upgrade the current package to the latest version.

sudo apt update 
sudo apt upgrade

Step 2 - Configure MySQL PPA

MySQL team official MySQL PPA is Debian Linux. You can download and install the package on a Debian system, which adds the PPA to your file system. Run the following command to enable the PPA.

wget http://repo.mysql.com/mysql-apt-config_0.8.13-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb

During the installation of MySQL apt config package, it prompts you to select the version of MySQL installed. Select the option MySQL 8.0 or 5.7 to be installed on your system.

In this tutorial, we have chosen MySQL 5.7 installed on my Debian system. After selecting a specific version and need to change the configuration, use the following command.

sudo dpkg-reconfigure mysql-apt-config

Select the version of your choice and save.

Step 3 - Debian 10 mounted on MySQL

Your system is ready to install MySQL. Run the following command to install MySQL on Debian computer.

sudo apt update 
sudo apt install mysql-server

The installation process will prompt root password to the default value. Enter the security code, confirm the password window. You will be required to log in the MySQL server MySQL root user password.

How to install MySQL on Debian 10 (Buster) Linux

The next window to reenter the same password.

MySQL 8 provides expanded options for password security. This is optional, but we recommend this option.

Debian install MySQL

Let the installation is complete.

Step 4 - MySQL Installation Security

To make safety changes to the database server execute the following command on the system. This will prompt some questions. High Security provide all the answers in the affirmative.

If it does not, first of all start MysQL services:

sudo systemctl restart mysql.service

Then run the following command:

sudo mysql_secure_installation

Follow the instructions on the screen

Securing the MySQL server deployment.

Enter password for user root:

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2

[...]

Select MEDIUM or STRONG password authentication policies. Thereafter, the process will require a password change. You can choose more complex passwords. Complete the wizard according to other options.

Step 5 - Connecting to MySQL

MySQL server has been installed on your system. Now use the command line to connect to the MySQL database.

mysql -u root -p

Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.17 MySQL Community Server - GPL

Copyright (c) 2000, 2019,  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.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

Guess you like

Origin www.linuxidc.com/Linux/2019-07/159582.htm