Install Mysql 8 on Debian 11
MySQL is a relational database management system based on the structured query Language, which is the popular language for accessing and managing the records in the database. MySQL is open-source and free software under the GNU license.
In this guide, we will show you how to install Mysql 8 on Debian 11 system.
Step 1: Add Mysql apt repo
download the MySQL APT repository and add it to your system and install it.
wget https://repo.mysql.com//mysql-apt-config_0.8.19-1_all.deb sudo dpkg -i mysql-apt-config_0.8.19-1_all.deb
During the package installation, you will be prompted to configure the Mysql APT repository. you need to be select Ok in drop down and press TAB key to select Ok. Press ENTER to proceed.
once official MySQL repository has been added,Next If prompted, select the repository for Debian buster and press the TAB key to select Ok. Press ENTER to proceed.
Then,update the package list with and install the MySQL server
sudo apt update sudo apt install mysql-community-server
Reading package lists... Done Building dependency tree... Done Reading state information... Done The following additional packages will be installed: libaio1 libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client mysql-common mysql-community-client mysql-community-client-core mysql-community-client-plugins mysql-community-server-core The following NEW packages will be installed: libaio1 libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client mysql-common mysql-community-client mysql-community-client-core mysql-community-client-plugins mysql-community-server mysql-community-server-core 0 upgraded, 12 newly installed, 0 to remove and 14 not upgraded. Need to get 33.2 MB of archives. After this operation, 280 MB of additional disk space will be used. Do you want to continue? [Y/n] y
During the installation of the package, a package configuration dialog window will show up, asking you to set a database root user password for your MySQL. Enter a secure and strong password then confirm it by re-entering it.
Set MySQL 8 default authentication plugin.
Once the installation is completed, the MySQL service will start automatically, you can verify with the following command.
sudo systemctl status mysql
● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2021-10-04 01:30:03 PDT; 5min ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 425 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
now secure mysql by running the following command.
it prompts enter root password and then checks validate password component.
you can press enter key for all checks which it promts.
Remove anonymous users? Disallow root login remotely? Remove test database and access to it? Reload privilege tables now? All done!
once it is done, you can login with root user to login into shell.
mysql -u root -p
root@debian:~# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 12 Server version: 8.0.26 MySQL Community Server - GPL Copyright (c) 2000, 2021, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>