How to install MySQL 8.0 Server on Debian 11 Bullseye


MySQL doesn’t need to be introduced, it’s been around for years and is a widely used open source database management system. Here we learn how to install MySQL server and client on Debian 11 Bullseye.

Well, just like Debian 10 Buster, Bullseye 11 also got MariaDB as the default MySQL variant to install. Yes, you will not be able to install Oracle MySQL using the default Debain 11 repository. Well, being a fork of MySQL, MariaDB will work similarly and stably. And compatible with all applications requiring MYSQL.

Nevertheless, still those who want Oracle’s MySQL and only its functionality, they can add its repository manually using this tutorial to get it.

Steps to install Oracle MySQL on Debian 11 Bullsyeye

The steps given in this tutorial can also be used for Debian 10 Buster and other similar Linux systems.

1. Download the Debian package from the MySQL repository

Setting up the MySQL directory on Debian and its based systems is very simple. Just go to its official community download page and there you will get the latest Apt repsotiory in the deb binary form for download. You can also use the given commands instead.

sudo apt install wget -y

2. Add the MySQL APT repository

Once you have the MySQL repository on your Debian 11 system as a binary package, let’s install it using the APT package manager.

sudo apt install ./mysql-apt-config_*_all.deb

You will have the option to select what you want to add through the repository. Use the arrow key to select MySQL server and cluster , then press the TONGUE button to select Okay and then press the Enter key.

Select the MySQL server and cluster

Select the available version of MySQL Server, here in our case it was myslq-8.0. After that use the TONGUE to select Okay and hit the Enter key.

Select the version of the database to install

Select again Okay then use the TONGUE to move to Okay and hit the Enter key.

This will automatically configure the latest Debian database repository on your Debian 11 server.

Additional information: In the future, if you want to add additional tools using its repository or if you want to reconfigure it, run:

sudo dpkg-reconfigure mysql-apt-config

3. Update the Debian 11 repository cache

After you add the repository, run the update system command to rebuild the cache. So that the system can recognize the packages available on your newly added repository.

sudo apt update

4. Command to install MySQL on Debian 11 Bullseye

Then, as with any regular package to be installed using the APT Package Manager, also install the MYSQL database server.

sudo apt install mysql-server

To note: If you already have MariaDB on your system and then delete it first to avoid conflicts.

Command to install Oracle MySQL server on Debian 11 Bullseye

Enter the password you want to use with the MySQL server and then select the strong authentication method:

Use the strong authentication method

5. Start and activate the database server service

Once the installation is complete, let’s start and activate the Oracle MySQL service on Debian 11, so that it can start automatically when the system boots.

sudo systemctl enable --now mysql

To check its status:

systemctl status mysql

Check the status of the database service

6. Secure your database server

This is the extra step to make sure that we take all necessary steps to ensure that our database is secure enough to prevent malicious attempts to access it by someone.

sudo mysql_secure_installation

Follow the text-based wizard to set a root password (if needed), delete the demo database, disallow remote root login, and delete anonymous users.

Secure deployment of the MySQL database on Debian 11 bullseye

That’s it, you’re done !! To learn more about managing database table and users using a web interface, refer to our other tutorial – Install phpMyAdmin on Debian 11 Bullseye

Source link


Comments are closed.