How to Install MySQL on Debian 11. MySQL is one of the most widely used database software for several well-known applications that utilize like WordPress and many more.
In this guide you are going to learn how to install latest MySQL community server on Debian.
This setup is tested on Google cloud, so it will work on all cloud hosting services like AWS, Azure or any VPS or any dedicated servers running Debian 11.
Table of Contents
Install MySQL on Debian 11 Prerequisites
- Root access to your server or a sudo user.
Step 1: Setup Initialization
Start by updating the packages to the latest version available using the following command.
sudo apt update sudo apt upgrade
Install wget package.
sudo apt install wget
Once you have updated the setup you can start the setup.
Step 2: Install MySQL
To add the MySQL APT repository to your system go to the repository download page and download the latest release package using the following command.
Install the release package.
sudo apt install ./mysql-apt-config_0.8.22-1_all.deb
We’re going to install MySQL version 8.0. Select OK by pressing Tab and hit Enter (as shown in the image above).
Now you can install MySQL.
sudo apt update sudo apt install mysql-server
Once the installation is completed, the MySQL service will start automatically. To verify that the MySQL server is running, type:
sudo service mysql status
The output should show that the service is enabled and running:
mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2022-02-07 09:32:48 UTC; 17s ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Main PID: 101929 (mysqld) Status: "Server is operational" Tasks: 38 (limit: 1148) Memory: 369.3M CPU: 805ms CGroup: /system.slice/mysql.service └─101929 /usr/sbin/mysqld Feb 07 09:32:48 demo systemd: Starting MySQL Community Server... Feb 07 09:32:49 demo systemd: Started MySQL Community Server.
Step 3: Secure MySQL
MySQL installation comes with a script named
mysql_secure_installation that allows you to easily improve the MySQL server security.
You will be asked to configure the
VALIDATE PASSWORD PLUGIN which is used to test the strength of the MySQL users passwords and improve the security.
y if you want to set up the validate password plugin or any other key to move to the next step.
There are three levels of password validation policy, low, medium, and strong.
Enter 2 for strong password validation.
On the next prompt, you will be asked to set a password for the MySQL root user.
If you set up the validate password plugin, the script will show you the strength of your new password. Type
y to confirm the password.
Next, you’ll be asked to remove the anonymous user, restrict root user access to the local machine, remove the test database, and reload privilege tables. You should answer
y to all questions.
Supercharge your Linux Administration Career with completed training course and get your dream job.
What are Some Common use Cases for MySQL Server Debian 11?
MySQL Server is a popular open-source relational database management system that uses structured query language (SQL) to store, manage, and access data. Some common use cases for MySQL Server Debian 11 are:
- Web Applications: MySQL Server is often used as the backend database for web applications that need to handle large amounts of data, such as e-commerce, social media, content management, and online gaming. MySQL Server can integrate well with various web development frameworks and languages, such as PHP, Java, Python, Ruby, and .NET. MySQL Server can also support high availability, scalability, and security features for web applications.
- Data Warehousing and Business Intelligence: MySQL Server can be used as a data warehouse to store and analyze large volumes of structured and semi-structured data from various sources, such as transactional systems, log files, sensors, and web services. MySQL Server can also support various business intelligence tools and applications that enable users to perform data mining, reporting, dashboarding, and visualization. MySQL Server can offer fast query performance, parallel processing, and compression capabilities for data warehousing and business intelligence use cases.
- Cloud Computing: MySQL Server can be deployed on various cloud platforms, such as Amazon Web Services (AWS), Microsoft Azure, Google Cloud Platform (GCP), and Oracle Cloud Infrastructure (OCI). MySQL Server can benefit from the flexibility, scalability, and cost-effectiveness of cloud computing. MySQL Server can also leverage cloud-native features, such as serverless computing, containerization, and microservices. MySQL Server can also integrate with other cloud services, such as storage, messaging, analytics, and machine learning.
- Internet of Things (IoT): MySQL Server can be used as a database for IoT applications that need to collect, store, and process large amounts of data from various devices and sensors. MySQL Server can handle different types of data formats, such as JSON, XML, CSV, and binary. MySQL Server can also support real-time data ingestion, streaming, processing, and analytics for IoT use cases. MySQL Server can also enable edge computing by running on low-power devices and providing local data processing capabilities.
Frequently Asked Questions
What are the Steps to Install MySQL on Debian 11?
To install MySQL on Debian 11, you can follow the steps outlined above:
Add the MySQL APT repository.
Update the package cache.
Install the MySQL server.
Secure the MySQL installation.
How do I Create a New User in MySQL?
To create a new user in MySQL, you can use the following command:
CREATE USER username IDENTIFIED BY 'password';
username with the name of the user you want to create and
password with the user’s password.
How do I Secure my MySQL Server Debian 11 Installation?
To secure your MySQL installation, you can follow these steps:
Change the root password.
Remove anonymous users.
Disable remote root login.
Remove the test database.
You can do all of this using the
What is the latest version of MySQL Server available for Debian 11?
The latest version of MySQL Server available for Debian 11 is 8.0.33.
Now you have learned how to install MySQL stack on Debian 11 and secure it.
Thanks for your time. If you face any problem or any feedback, please leave a comment below.