Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Install MySQL on Debian 11 - DesignLinux

Nov 28 2022
designlinux 0 Comments
how-to-install-mysql-on-debian-11

MySQL is free and most widely open-source database management system. MySQL is no longer available since release of Debian 10 and MariaDB has become the default database system. MariaDB is the default database system in Debian 11. This tutorial will describe how to install MySQL on Debian 11 from the MySQL Apt repository.

How to Install MySQL on Debian 11#

Follow the below given steps to install MySQL on your Debian 11 system:

Step 1 – Download Repositories

At first, we will download the latest MySQL release package from MySQL official PPA of Debian using wget command. Run the below given command to add the MySQL APT repository to your system:

wget http://repo.mysql.com/mysql-apt-config_0.8.24-1_all.deb

Step 2 – Add MySQL Repositories

Once the package download completed, install the release package with root or user with sudo privileges:

sudo apt install ./mysql-apt-config_0.8.24-1_all.deb

It will prompt you to configuration menu where you can select MySQL version whatever you want like below:

debian-select-mysql-version

By default, MySQL 8.0 is selected. You can install another version by selecting MySQL Server & Cluster (Currently selected: mysql-8.0) option and choose version as per your requirement. In this guide, we will install MySQL 8.0 so select the last option Ok and hit Enter key to save changes.

Step 3 – Install MySQL

At this step, your system is ready to install MySQL. First, you need to update the package list using:

sudo apt update

Use the below command to install MySQL server on your Debian system:

sudo apt install mysql-server

It will prompt to set root user password as below. Enter a strong password for root user and hit Ok button. Again, It will ask to re-enter password. This password will be use as root user password.

Next, you will be presented with a message informing you about the new MySQL 8 authentication.

After that, it will prompt with a message informing you about the new MySQL 8 authentication. Before selecting the default MySQL 8 authentication plugin make sure it is supported by your application.

debian-mysql-select-authentication

Step 4 – Verify Installation

It will start the MySQL service automatically once the installation is completed. To check the MySQL service status issue below given command:

sudo systemctl status mysql

It should show below output if service active:

● mysql.service - MySQL Community Server
    Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en
    Active: active (running) since Thr 2022-11-25 16:40:45 UTC; 20s ago
    ...

Step 5 – Secure MySQL Installation

You can improve MySQL security by execute the mysql_secure_installation command. It’s a MySQL inbuilt security script. Run then below command:

sudo mysql_secure_installation

Once you execute this command it will prompt you to enter root user password which you set before this step. After that, it will ask you to choose whether to use the VALIDATE PASSWORD PLUGIN or not, which can be use to test the strength of your MySQL password. Press ENTER if you don’t want to set up the validate password plugin.

Next, It will ask if you want to change current root user password. If your current password is perfect then, enter N for No at the prompt.

Now, for all next questions press Y and hit Enter key for each. This will remove some anonymous users and test database, disable remote root logins and load these new rules so that MySQL immediately respects the changes you have made. Following questions will be prompt and you have to press yes/y for all :

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y

Step 5 – Connect MySQL

You can login to MySQL server using command line using below command:

mysql -u root -p

It will prompt to enter root user password which you set before and it will show you output as below:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.31 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>

Conclusion#

You learned how to install MySQL 8.0 and Secure MySQL on Debian 11 Bullseye. You should stick to MariaDB the default database system of Debian 11.

Feel free to leave a comment below, if you are facing any issue.

Related

Tags: debian, mysql

How to Install MySQL on Ubuntu 22.04

Prev Post

How to Access a Remote Server Using a SSH Jump Host

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 0
  • 58
  • 1,054,830

DesignLinux.com © All rights reserved

Go to mobile version