MySQL doesn’t need any introduction, it has been around for years and 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, the 11 Bullseye also got the MariaDB as the default MySQL variant to install. Yes, you won’t be able to install the Oracle MySQL using the default repository of Debain 11. Well, being a fork of MySQL, MariaDB will work similar and also stable. And compatible with all application that required the MYSQL.
Nevertheles, still those who want Oracle’s MySQL and only its features they can add its repository manually using this tutorial to get it.
Steps to install Oracle MySQL on Debian 11 Bullsyeye
The given steps in this tutorial can be used for Debian 10 Buster as well and other similar Linux systems.
1. Download MySQL repository Debian package
Configuration of MySQL repsotiory on Debian and its based systems is very easy. Just go to its official community download page and there you will get the latest Apt repsotiory in the deb binary form to download. You can also use the given commands instead.
sudo apt install wget -y
2. Add MySQL APT repostiory
Once you have the MySQL repo on your Debian 11 system in the form of binary package, let’s install the same using the APT package manager.
sudo apt install ./mysql-apt-config_*_all.deb
You will get option to select for what you want to add via the repository. Use the Arrow key, select MySQL Server & Cluster , then press the TAB button to select OK and hit then the Enter key.
Select the available version of MySQL Server, here in our case it was myslq-8.0. After that use the TAB to select OK and hit the Enter key.
Again Select OK and then use the TAB to move to OK and hit the Enter key.
This will automatically configure the latest Debian repository of the Database on your Debian 11 server.
Extra info: In the future, if you want to add any additional tools using its repository or want to reconfigure it run:
sudo dpkg-reconfigure mysql-apt-config
3. Refresh the Debian 11 Repository cache
Once you have added the repo, run the system update command to rebuild the cache. So that the system can recognize the packages available on your newly added repo.
sudo apt update
4. Command to install MySQL on Debian 11 Bullseye
Next, like for any regular package to install using the APT package manager install the MYSQL Database server as well.
sudo apt install mysql-server
Note: If you already have MariaDB on your system then first remove the same to avoid conflicts.
Enter the password that you want to use with the MySQL server and then select the Strong authentication method:
5. Start and Enable Database server service
Once the installation is completed, let’s start and enable the service of Oracle MySQL on Debian 11, so that it could start automatically with system boot.
sudo systemctl enable --now mysql
To check its status:
systemctl status mysql
6. Secure your Database server
This is the extra step to make sure we take all necessary steps to make sure our database is secure enough to dodge any malicious attempt to access it by someone.
Follow the text-based wizard to set a root password (if required), remove the demo database, disallow remote root login and remove anonymous users.
That’s it, you are done!! To know further how to manage Database table and users using a web interface, refer to our another tutorial- Install phpMyAdmin on Debian 11 Bullseye