Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Databases»MySQL»How To Install MySQL on Debian 10

    How To Install MySQL on Debian 10

    RahulBy RahulJuly 23, 20194 Mins ReadUpdated:February 14, 2021

    As today, Debian Buster is the latest release available for the Debian operating systems. Which is also known as Debian 10. The newer Debian release has MariaDB as default in their repositories. Now, this tutorial will help you to install MySQL 8 or MySQL 5.7 on Debian 10 (Buster) Linux systems.

    Step 1 – Prerequisites

    Login to your Debian 10 system using shell access. For remote systems connect with SSH. Windows users can use Putty or other alternatives applications for SSH connection.

    ssh [email protected]
    

    Run below commands to upgrade the current packages to the latest version.

    sudo apt update 
    sudo apt upgrade
    

    Step 2 – Configure MySQL PPA

    MySQL team provides official MySQL PPA for Debian Linux. You can download and install the package on your Debian system, which will add PPA file to your system. Run below command to enable 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 will prompt to select MySQL version to install. Select the MySQL 8.0 or 5.7 option to install on your system.

    For this tutorial, we have selected MySQL 5.7 to install on my Debian system. Once you have selected a specific version and you need to change the configuration, use the following command.

    sudo dpkg-reconfigure mysql-apt-config
    

    Select a version of your choice and save.

    Step 3 – Install MySQL on Debian 10

    Your system is ready for the MySQL installation. Run the following commands to install MySQL on a Debian machine.

    sudo apt update 
    sudo apt install mysql-server
    

    The installation process will prompt for the root password to set as default. Input a secure password and same to confirm password window. This will be MySQL root user password required to log in to MySQL server.

    Install MySQL on Debian 10

    The next window will ask to re-enter the same password.

    MySQL 8 provides an extended password security option. This is optional but we recommend to go with this option.

    Debian install MySQL

    Let the installation complete.

    Step 4 – Secure MySQL Installation

    Execute the below command on your system to make security changes on your Database Server. This will prompt some questions. The do the high security provide all answers to yes.

    First start the MysQL service if not started:

    sudo systemctl restart mysql.service
    

    Then run below command:

    sudo mysql_secure_installation
    

    Follow the on screen instruction’s

    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 a password validation policy to MEDIUM or STRONG. After that, the process will ask to change the password. You can select a more complex password. Follow the other options and complete the wizard.

    Step 5 – Connect MySQL

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

    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, 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.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql>
    
    Debian 10 MySQL MySQL 8
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Install PostgreSQL 11 on Debian 10 (Buster)
    Next Article How To Install Visual Studio Code on macOS

    Related Posts

    Backup MySQL Databases to Amazon S3 (Shell Script)

    Updated:May 28, 20222 Mins Read

    How to Install MariaDB on Ubuntu 22.04

    Updated:May 28, 20222 Mins Read

    How To Install Linux, Nginx, MySQL, & PHP (LEMP Stack) on Ubuntu 22.04

    Updated:April 7, 20227 Mins Read

    How To Install MySQL Server on Ubuntu 22.04

    Updated:April 6, 20224 Mins Read

    How to Install Apache, MySQL, PHP (LAMP Stack) on Ubuntu 22.04

    Updated:June 28, 20225 Mins Read

    How To Install MariaDB on Debian 11

    4 Mins Read

    7 Comments

    1. bob on October 29, 2021 10:37 pm

      Doesn’t seem to work anymore. Thanks anyway.

      Reply
    2. Raoul on April 9, 2021 1:08 pm

      Good job Rahul.
      This help me for my project and to write another tutoriel.
      Best regard.

      Reply
    3. Dave on January 21, 2020 1:48 pm

      Thanks! Excelent tutorial, very straight to the point.

      Reply
    4. warner Krelekamp on October 11, 2019 6:40 am

      I get an error: “apt-key should not be used in scrips” on debian10

      Reply
    5. Ken Ingram on October 2, 2019 9:53 am

      How do you deal with this error:

      (Reading database … 457219 files and directories currently installed.)
      Preparing to unpack mysql-apt-config_0.8.13-1_all.deb …
      Unpacking mysql-apt-config (0.8.13-1) over (0.8.13-1) …
      Setting up mysql-apt-config (0.8.13-1) …

      Warning: apt-key should not be used in scripts (called from postinst maintainerscript of the package mysql-apt-config)
      OK

      Reply
    6. babe on September 26, 2019 8:17 pm

      Thanks <3

      Reply
    7. Kenneth on September 15, 2019 5:20 pm

      Thanks!! Short a clear!

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • How To Install Docker on Ubuntu 22.04
    • How to Install Bower on Ubuntu 22.04 & 20.04
    • How to run “npm start” through Docker
    • Filesystem Hierarchy Structure (FHS) in Linux
    • How to accept user input in Python
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.