Table of Contents
This tip is about the how to configure MySQL 8.0 Server on Debian 11 Bullseye. So read this free guide, How to configure MySQL 8.0 Server on Debian 11 Bullseye. If you have query related to same article you may contact us.
How to configure MySQL 8.0 Server on Debian 11 Bullseye – Guide
Here are all the details to help you install MySQL 8 on Debian 11. This guide is for a fresh install of MySQL 8.0 on Debian 11 on a server that does not have MariaDB or any other version to run MySQL. If you have an older version of MySQL Server (eg 5.7), you will need to do a tidy upgrade or dump all data, update the packages, and import all the data from the database back into MySQL 8.0.
prerequisites
Updating operating system
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 be using the wget command to install the package using the following command:
sudo apt install wget -y
Note that wget should be installed automatically, but run the command to see if you are unsure.
Import MySQL repository
To install the latest version of MySQL, you will need to download and install the MySQL APT .deb repository package that will set up 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 MySQL repository installation, you will see the following pop-up windows:
First, given that Debian 11 stable was just released at the time of this tutorial, MySQL will inform you that it does not support the release. This can be fixed by selecting the old stable version Buster, and it 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 set up correctly for the latest version, then using the arrow keys scroll down and select ok to continue:
Select OK to proceed with the installation:
Once this is done, you will get the following message back on your terminal:
OK
To reflect the new repository, use the apt update command:
sudo apt update
Install MySQL 8
Now that you have finished importing the repository into MySQL, run the command to install as follows:
sudo apt install mysql-server
Type Y and press the Enter key to proceed with the installation.
During installation, a new pop-up will appear, prompting you to enter the database root password. Make sure it is secure 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 will appear for you to read about the new authentication system.
Then set the default selection for MySQL for authentication plugin as below.
Installation must finish up after this point. To confirm that it installed successfully, run the following apt policy command, which will also confirm the current version and build of the MySQL database server:
apt policy mysql-server
Check the status of the MySQL 8 server
The installer will automatically start your MySQL service by default and configure itself to start automatically at system startup. To verify that the MySQL service is operational after installation, enter 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 at system startup:
sudo systemctl disable mysql
To enable MySQL service at system startup:
sudo systemctl enable mysql
To restart the MySQL service:
sudo systemctl restart mysql
Secure MySQL 8 with security script
When installing new MySQL, the default settings are considered weak by most standards and are of concern for potentially allowing intrusion or hacker exploitation. One solution is to run the install security script that comes with the MySQL installation.
First, use the following command to start (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 define password complexity checks; for most, the default is fine.
Then follow below:
Note, you use (Y) to remove everything. Also, if you wish, you can reset your root password by creating a new one; you can skip this if you like as you already set it during the initial install with pop-up windows.
Log into the MySQL 8 instance
Now that you have completed the post-install install security script, log into your MySQL database using the following:
sudo mysql -u root -p
You will be prompted to enter the root password defined in the install setup or post-install security script. Once inside the MySQL service instance, you can run the following command as a test to see it up and running.
Enter the following SHOW DATABASE command:
SHOW DATABASES;
For those new to MySQL, all commands must end with “;”
To exit the terminal, type the following exit command:
exit;
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 note
I hope you like the guide How to configure MySQL 8.0 Server on Debian 11 Bullseye. In case if you have any query regards this article you may ask us. Also, please share your love by sharing this article with your friends.