{"id":10145,"date":"2021-08-21T11:35:33","date_gmt":"2021-08-21T08:35:33","guid":{"rendered":"https:\/\/kifarunix.com\/?p=10145"},"modified":"2024-03-18T18:47:33","modified_gmt":"2024-03-18T15:47:33","slug":"install-mysql-8-on-debian-11","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-mysql-8-on-debian-11\/","title":{"rendered":"Install MySQL 8 on Debian 11"},"content":{"rendered":"\n
This guide provides a step-wise tutorial on how to install MySQL 8 on Debian 11. MySQL<\/a> is a fast, stable and true multi-user, multi-threaded SQL database server with its main goals being speed, robustness and ease of use. To see a comprehensive description of the features offered by MySQL 8, navigate to MySQL 8 Reference Manual<\/a>.<\/p>\n\n\n\n Debian 11 doesn’t ship with MySQL 8 on its default repositories.<\/p>\n\n\n\n The recommended way to install MySQL 8 is via the MySQL APT repository. <\/p>\n\n\n\n As a result, you need to install MySQL APT repository on Debian 11. This makes the installation of MySQL 8 a seamless task.<\/p>\n\n\n\n Download MySQL 8 APT repository installer;<\/p>\n\n\n\n Install MySQL APT repository;<\/p>\n\n\n\n If prompted, select the repository for debian bullseye <\/strong>and press TAB<\/strong> key to select Ok. Press ENTER to proceed.<\/p>\n\n\n\n Next, on the MySQL product, select Ok<\/strong> and press TAB<\/strong> key to select Ok. Press ENTER to proceed to install the repository.<\/p>\n\n\n\n If re-prompted for product selection, do as above and press ENTER to finalize the installation of MySQL APT repository.<\/p>\n\n\n\n Before you can proceed, update and upgrade your system packages.<\/p>\n\n\n\n Next, install MySQL 8 by executing the command below;<\/p>\n\n\n\n The command installs MySQL 8 and all required package dependency.<\/p>\n\n\n\n During the installation, you are prompted to set MySQL 8 root password;<\/p>\n\n\n\n Set MySQL 8 default authentication plugin.<\/p>\n\n\n\n Once installed, MySQL 8 is started and enabled to run on system boot;<\/p>\n\n\n\n You can stop\/start\/restart using the commands below, respectively;<\/p>\n\n\n\n MySQL ships with a security script called The script can be simply execute by running;<\/p>\n\n\n\n When run, the script prompts you on whether you want to implement password complexity checks. Accept the choose the strength of the password;<\/p>\n\n\n\n Next, set the root password and accept other prompts to remove anonymous database users, disallow remote root login, remove test databases and reload privileges tables to effect the changes on MySQL.<\/p>\n\n\n\n You can verify the version of MySQL installed by executing;<\/p>\n\n\n\n You can now connect to MySQL 8 as a root user with the password you just set above.<\/p>\n\n\n\n Once logged in to MySQL, you can as well check the version by executing the command;<\/p>\n\n\n\n There you go.<\/p>\n\n\n\n Install MariaDB 10.6 on Debian 11<\/a><\/p>\n\n\n\nInstalling MySQL 8 on Debian 11<\/h2>\n\n\n\n
apt show mysql-server<\/code><\/pre>\n\n\n\n
Package: mysql-server\nState: not a real package (virtual)\nN: Can't select candidate version from package mysql-server as it has no candidate\nN: Can't select versions from package 'mysql-server' as it is purely virtual\nN: No packages found<\/code><\/pre>\n\n\n\n
Install MySQL APT Repository on Debian 11<\/h3>\n\n\n\n
wget https:\/\/repo.mysql.com\/\/mysql-apt-config_0.8.24-1_all.deb<\/code><\/pre>\n\n\n\n
apt install .\/<\/meta>mysql-apt-config_0.8.24-1_all.deb -y<\/code><\/pre>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
Run System Update<\/h3>\n\n\n\n
apt update<\/code><\/pre>\n\n\n\n
apt install mysql-server<\/code><\/pre>\n\n\n\n
Reading package lists... Done\nBuilding dependency tree... Done\nReading state information... Done\nThe following additional packages will be installed:\n libaio1 libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client mysql-common mysql-community-client mysql-community-client-core mysql-community-client-plugins\n mysql-community-server mysql-community-server-core psmisc\nThe following NEW packages will be installed:\n libaio1 libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client mysql-common mysql-community-client mysql-community-client-core mysql-community-client-plugins\n mysql-community-server mysql-community-server-core mysql-server psmisc\n0 upgraded, 14 newly installed, 0 to remove and 0 not upgraded.\nNeed to get 33.4 MB of archives.\nAfter this operation, 282 MB of additional disk space will be used.\nDo you want to continue? [Y\/n] y\n...\n<\/code><\/pre>\n\n\n\n
<\/figure><\/a><\/div>\n\n\n\n
<\/figure><\/a><\/div>\n\n\n\n
Running MySQL 8 on Debian 11<\/h3>\n\n\n\n
systemctl status mysql<\/code><\/pre>\n\n\n\n
\u25cf mysql.service - MySQL Community Server\n Loaded: loaded (\/lib\/systemd\/system\/mysql.service; enabled; vendor preset: enabled)\n Active: active (running) since Sat 2021-08-21 11:10:46 EAT; 30s ago\n Docs: man:mysqld(8)\n http:\/\/dev.mysql.com\/doc\/refman\/en\/using-systemd.html\n Process: 2193 ExecStartPre=\/usr\/share\/mysql-8.0\/mysql-systemd-start pre (code=exited, status=0\/SUCCESS)\n Main PID: 2228 (mysqld)\n Status: \"Server is operational\"\n Tasks: 38 (limit: 1133)\n Memory: 356.8M\n CPU: 1.388s\n CGroup: \/system.slice\/mysql.service\n \u2514\u25002228 \/usr\/sbin\/mysqld\n\nAug 21 11:10:40 debian11 systemd[1]: Starting MySQL Community Server...\nAug 21 11:10:46 debian11 systemd[1]: Started MySQL Community Server.\n\n<\/code><\/pre>\n\n\n\n
systemctl is-enabled mysql<\/code><\/pre>\n\n\n\n
enabled<\/code><\/pre>\n\n\n\n
systemctl stop mysql<\/code><\/pre>\n\n\n\n
systemctl start mysql<\/code><\/pre>\n\n\n\n
systemctl restart mysql<\/code><\/pre>\n\n\n\n
Secure MySQL 8 Installation on Debian 11<\/h3>\n\n\n\n
mysql_secure_installation<\/code> that enables you to implement initial security of MySQL installation in the following ways:<\/p>\n\n\n\n
\n
mysql_secure_installation<\/code><\/pre>\n\n\n\n
VALIDATE PASSWORD COMPONENT can be used to test passwords\nand improve security. It checks the strength of password\nand allows the users to set only those passwords which are\nsecure enough. Would you like to setup VALIDATE PASSWORD component?\n\nPress y|Y for Yes, any other key for No: y\n\nThere are three levels of password validation policy:\n\nLOW Length >= 8\nMEDIUM Length >= 8, numeric, mixed case, and special characters\nSTRONG Length >= 8, numeric, mixed case, special characters and dictionary file\n\nPlease enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2\n...\n<\/code><\/pre>\n\n\n\n
Checking the Version of MySQL Installed<\/h3>\n\n\n\n
mysql -V<\/code><\/pre>\n\n\n\n
mysql Ver 8.0.26 for Linux on x86_64 (MySQL Community Server - GPL)<\/code><\/pre>\n\n\n\n
Logging in to MySQL 8<\/h3>\n\n\n\n
mysql -u root -p<\/code><\/pre>\n\n\n\n
mysql> SHOW VARIABLES LIKE \"%version%\";<\/strong><\/code><\/pre>\n\n\n\n
+--------------------------+-------------------------------+\n| Variable_name | Value |\n+--------------------------+-------------------------------+\n| admin_tls_version | TLSv1,TLSv1.1,TLSv1.2,TLSv1.3 |\n| immediate_server_version | 999999 |\n| innodb_version | 8.0.26 |\n| original_server_version | 999999 |\n| protocol_version | 10 |\n| replica_type_conversions | |\n| slave_type_conversions | |\n| tls_version | TLSv1,TLSv1.1,TLSv1.2,TLSv1.3 |\n| version | 8.0.26 |\n| version_comment | MySQL Community Server - GPL |\n| version_compile_machine | x86_64 |\n| version_compile_os | Linux |\n| version_compile_zlib | 1.2.11 |\n+--------------------------+-------------------------------+\n13 rows in set (0.06 sec)\n\nmysql>\n<\/code><\/pre>\n\n\n\n
Related Tutorials<\/h3>\n\n\n\n