Debian Install MySQL. Debian 12 is one of the most popular and stable Linux distributions in the world. It is known for its security, reliability, and versatility. Debian supports a wide range of architectures and software packages, making it a great choice for both desktop and server users.
MySQL is the world’s most popular open source database. It is widely used for web development, data analysis, and business applications. MySQL is fast, scalable, and easy to use. It supports various data types, storage engines, and programming languages.
In this article, we will show you how to install MySQL on Debian 12 in a step-by-step manner.
Prerequisites
Before we begin, make sure that you have the following requirements:
- A Debian 12 system with root or sudo access. You can use your own system or a virtual machine or a cloud server.
- A stable internet connection.
- Basic SSH terminal knowledge.
When you have all the mentioned prerequisites, you can proceed to the next step.
Initial Setup
Start by updating the system packages on your Debian system. This will ensure that you have the latest security patches and bug fixes. To update the system packages, run the following command in the terminal or SSH client:
sudo apt update
sudo apt upgrade
These commands will update the list of available packages and install any new or updated packages. Once the update is completed, you can move on to the next step.
Debian Install MySQL Server
To install the MySQL server on Debian you need to download the latest APT repository from the official MySQL website. Execute the following command in the terminal or SSH client to download the repository.
wget https://dev.mysql.com/get/mysql-apt-config_0.8.29-1_all.deb
Now install the downloaded package using the following command:
sudo apt install ./mysql-apt-config_0.8.29-1_all.deb
As we’re going to install MySQL version 8.0, press TAB and select OK and hit Enter to select the version.
In the following screen press TAB and select OK.
Again in the following screen use your down arrow key to select the OK that is among the options.
Now you can proceed to Debian 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; preset: enable>
Active: active (running) since Tue 2024-02-06 04:58:49 UTC; 28s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Main PID: 2523 (mysqld)
Status: "Server is operational"
Tasks: 38 (limit: 1141)
Memory: 358.5M
CPU: 1.333s
CGroup: /system.slice/mysql.service
└─2523 /usr/sbin/mysqld
Verify MySQL Version
You can check and verify your MySQL version using the below command:
mysql -V
mysql Ver 8.0.36 for Linux on x86_64 (MySQL Community Server - GPL)
Secure Debian Install MySQL
Securing your Debian Install MySQL will help you to improve the security and reliability of your MySQL server. To secure the MySQL installation, you need to run the mysql_secure_installation
script. This script will ask you a series of questions and perform some actions based on your answers. To run the mysql_secure_installation
script, run the following command in the terminal or SSH client:
sudo mysql_secure_installation
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.
Press 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.
Conclusion
Now you have learned how to install MySQL on Debian 12 and secure it.
Thanks for your time. If you face any problem or any feedback, please leave a comment below.
Frequently Asked Questions
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';
Replace username
with the name of the user you want to create and password
with the user’s password.
What is the latest version of MySQL Server available for Debian 12?
The latest version of MySQL Server available for Debian 12 is 8.0.36.
Leave your Reply