This tutorial is about How to configure MySQL 8.0 Server on Debian 11 Bullseye. Recently I updated this tutorial and will try my best so that you understand this guide. I hope you guys like this blog, How to configure MySQL 8.0 Server on Debian 11 Bullseye. If your answer is yes after reading the article, please share this article with your friends and family to support us.
Check How to configure MySQL 8.0 Server on Debian 11 Bullseye
Here are all the details to help you install MySQL 8 on Debian 11. This guide is for a fresh installation of MySQL 8.0 on Debian 11 on a server that does not have MariaDB or any other version for MySQL running. If you have an older version of MySQL Server (for example, 5.7), you will need to perform an organized upgrade or dump all data, upgrade packages, and import all database data back to MySQL 8.0.
Prerequisites
- Recommended OS: Debian 11 Bullseye
- User account: A user account with sudo or root access.
- Required packages: wget or curl
OS update
Update your Debian 11 operating system to make sure all existing packages are up to date:
sudo apt update && sudo apt update
Install the WGET package
The tutorial will use the wget command to install the package using the following command:
sudo apt install wget -y
Note that wget should install automatically, but run the command to check if you’re not sure.
Import MySQL repository
To install the latest version of MySQL, you will need to download and install the MySQL APT .deb repository package which will configure and install the MySQL software repositories on your Debian system.
Use the following command below to download to your TMP folder:
cd / tmpwget https://dev.mysql.com/get/mysql-apt-config_0.8.18-1_all.debsudo dpkg -i mysql-apt-config_0.8.18-1_all.deb
During the installation of the MySQL repository, you will see the following pop-up windows:
First, since Debian 11 stable has just been released at the time of this tutorial, MySQL will inform you that it is not supported on the release. This can be fixed by selecting the older stable version of Buster, and this will work fine:
Select Buster and press the Enter key.
Second, you will be asked to confirm which version of MySQL you want to install; For now, it is correctly configured for the latest version, so using the arrow keys, scroll down and select OK to continue:
Select OK to continue with the installation:
Once this is done, you will receive the following message in your terminal:
okay
To mirror the new repository, use the apt update command:
sudo apt update
Install MySQL 8
Now that you have completed the repository import for MySQL, run the install command as follows:
sudo apt install mysql server
Type Y, then press the Enter key to continue with the installation.
During installation, a new pop-up window will appear asking you to enter the database root password. Make sure it is safe and registered. Once entered, press the Enter key or press the Tab key to select
Note that you will be prompted to re-enter the root password a second time to confirm.
Then another pop-up window will appear for you to read about the new authentication system.
Next, configure the default selection for MySQL for the authentication plugin as shown below.
The installation should finish after this point. To confirm that it has been installed correctly, run the following apt policy command, which will also confirm the current version and build of the MySQL database server:
apt mysql-server policy
Check the status of the MySQL 8 server
The installer will automatically start your MySQL service by default and will be configured to start automatically on system startup. To verify that your MySQL service is operational after installation, type the following systemctl command:
sudo systemctl mysql status
To stop the MySQL service:
sudo systemctl stop mysql
To start the MySQL service:
sudo systemctl start mysql
To disable the MySQL service on system boot:
sudo systemctl disable mysql
To enable the MySQL service at system boot:
sudo systemctl enable mysql
To restart the MySQL service:
sudo systemctl restart mysql
Protect MySQL 8 with Security Script
When installing MySQL Most standards consider the new default settings to be weak and cause concern about allowing possible intrusions or exploiting hackers. One solution is to run the install security script that comes with the MySQL installation.
First, use the following command to run (mysql_secure_installation):
sudo mysql_secure_installation
You will be asked to enter your root password, and then you will see a question about VALIDATE PASSWORD COMPONENT; this is to establish password complexity checks; for most, the default is fine.
Then follow below:
- Set password for root accounts.
- Removal of root accounts that can be accessed from outside the local host.
- Delete anonymous user accounts.
- Removal of the test database, which is accessible by anonymous users by default.
Note, you use (AND) to remove everything. Also, if you want, you can reset your root password by creating a new one; you can skip this if you want as you already set it up during the initial installation with the pop-ups.
Login to the MySQL 8 instance
Now that you have completed the post-installation security script, you can log into your MySQL database using the following:
sudo mysql -u root -p
You will be prompted to enter the root password that you set in the installation setup or in the post-installation security script. Once inside the MySQL service instance, you can run the following command as a test to see it working.
Enter the following SHOW DATABASE command:
SHOW DATABASES;
For those of you new to MySQL, all commands must end with “;”
To exit the terminal, type the following exit command:
Departure;
Uninstall MySQL 8
If you no longer want to use the MySQL database and want to remove it completely, run the following command:
sudo apt autoremove mysql server
Final remarks: How to configure MySQL 8.0 Server on Debian 11 Bullseye
I hope you understand this article, How to configure MySQL 8.0 Server on Debian 11 Bullseye. If your answer is no, you can ask anything via the contact forum section related to this article. And if your answer is yes, please share this article with your friends and family to give us your support.