{"id":10147,"date":"2021-08-21T09:38:31","date_gmt":"2021-08-21T06:38:31","guid":{"rendered":"https:\/\/kifarunix.com\/?p=10147"},"modified":"2024-03-18T18:48:10","modified_gmt":"2024-03-18T15:48:10","slug":"install-mariadb-10-6-on-debian-11","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-mariadb-10-6-on-debian-11\/","title":{"rendered":"Install MariaDB 10.6 on Debian 11"},"content":{"rendered":"\n
Follow through this guide to learn how to install MariaDB 10.6 on Debian 11. \u201cMariaDB 10.6<\/a> is the current stable series of MariaDB. It is an evolution of MariaDB 10.5<\/a> with several entirely new features and improvements<\/a>“<\/em>.<\/p>\n\n\n\n Assuming that you are installing MariaDB 10.6 on a newly installed Debian 11, update and upgrade your system packages.<\/p>\n\n\n\n There are two methods in which you can install MariaDB;<\/p>\n\n\n\n MariaDB 10.5 is the currently available version on the default Debian 11 repos;<\/p>\n\n\n\n Therefore, to install MariaDB 10.6, you need to install MariaDB 10.6 APT repos.<\/p>\n\n\n\n Execute the commands below to install MariaDB 10.6 APT repos;<\/p>\n\n\n\n Next, head over to MariaDB repositories site<\/a> to choose your mirrors.<\/p>\n\n\n\n Choose your Linux distro, distro release, MariaDB version to install and finally the Mirrors to use.<\/p>\n\n\n\n To use UKfast mirrors, for example, run the command below;<\/p>\n\n\n\n Resynchronize your package cache;<\/p>\n\n\n\n Install MariaDB 10.6;<\/p>\n\n\n\n While this is not the recommended way of installing MariaDB, you can as well download .deb binary files and install it.<\/p>\n\n\n\n Follow the link below to learn how to install MariaDB using the .deb files.<\/p>\n\n\n\n Install MariaDB using deb binary files<\/a><\/p>\n\n\n\n To check the version of installed MariaDB, run the command below;<\/p>\n\n\n\n Upon installation, MariaDB is started and enabled to run on system boot;<\/p>\n\n\n\n You can manage the service via systemctl command.<\/p>\n\n\n\n For example, to stop MariaDB service;<\/p>\n\n\n\n To stop the service;<\/p>\n\n\n\n Disable the service from running on system boot;<\/p>\n\n\n\n MariaDB comes with a default security script, Simply run the command below to launch the script.<\/p>\n\n\n\n The new installations of MariaDB have two secure accounts are created during the installation.<\/p>\n\n\n\n The accounts are Both accounts uses either of the With or<\/p>\n\n\n\n Even if you run, As a user with sudo rights, prefix the commands above with The This re-enables the MariaDB password authentication and hence, you can now login as non root or non sudo user.<\/p>\n\n\n\n Similarly, you can login as mysql user;<\/p>\n\n\n\n To completely disable Next time you try to login without specifying the password, login will fail.<\/p>\n\n\n\n That marks the end of our guide on how to install MariaDB on Debian 11.<\/p>\n\n\n\nInstalling MariaDB 10.6 on Debian 11<\/h2>\n\n\n\n
Run System Update<\/h3>\n\n\n\n
apt update <\/code><\/pre>\n\n\n\n
apt upgrade<\/code><\/pre>\n\n\n\n
\n
Install MariaDB 10.6 from APT Repository<\/h3>\n\n\n\n
apt show mariadb-server<\/code><\/pre>\n\n\n\n
\nPackage: mariadb-server\nVersion: 1:10.5.11-1\nPriority: optional\nSection: database\nSource: mariadb-10.5\nMaintainer: Debian MySQL Maintainers
Install MariaDB 10.6 APT repos on Debian 11<\/h4>\n\n\n\n
apt install software-properties-common dirmngr<\/code><\/pre>\n\n\n\n
apt-key adv --fetch-keys 'https:\/\/mariadb.org\/mariadb_release_signing_key.asc'<\/code><\/pre>\n\n\n\n
add-apt-repository 'deb [arch=amd64,arm64,ppc64el] https:\/\/mirrors.ukfast.co.uk\/sites\/mariadb\/repo\/10.6\/debian bullseye main'<\/code><\/pre>\n\n\n\n
apt update<\/code><\/pre>\n\n\n\n
apt install mariadb-server<\/code><\/pre>\n\n\n\n
Install MariaDB 10.6 using .DEB Binary Files<\/h4>\n\n\n\n
Verify the MariaDB installed version<\/h4>\n\n\n\n
mysql -V<\/code><\/pre>\n\n\n\n
mysql Ver 15.1 Distrib 10.6.4-MariaDB, for debian-linux-gnu (x86_64) using readline EditLine wrapper<\/code><\/pre>\n\n\n\n
Running MariaDB 10.6 on Debian 11<\/h4>\n\n\n\n
systemctl status mariadb<\/code><\/pre>\n\n\n\n
\n\u25cf mariadb.service - MariaDB 10.6.4 database server\n Loaded: loaded (\/lib\/systemd\/system\/mariadb.service; enabled; vendor preset: enabled)\n Drop-In: \/etc\/systemd\/system\/mariadb.service.d\n \u2514\u2500migrated-from-my.cnf-settings.conf\n Active: active (running) since Sat 2021-08-21 08:44:32 EAT; 5min ago\n Docs: man:mariadbd(8)\n https:\/\/mariadb.com\/kb\/en\/library\/systemd\/\n Process: 3466 ExecStartPre=\/usr\/bin\/install -m 755 -o mysql -g root -d \/var\/run\/mysqld (code=exited, status=0\/SUCCESS)\n Process: 3467 ExecStartPre=\/bin\/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0\/SUCCESS)\n Process: 3469 ExecStartPre=\/bin\/sh -c [ ! -e \/usr\/bin\/galera_recovery ] && VAR= || VAR=`cd \/usr\/bin\/..; \/usr\/bin\/galera_recovery`; [ $? -eq 0 ] && systemctl set-en>\n Process: 3529 ExecStartPost=\/bin\/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0\/SUCCESS)\n Process: 3531 ExecStartPost=\/etc\/mysql\/debian-start (code=exited, status=0\/SUCCESS)\n Main PID: 3516 (mariadbd)\n Status: \"Taking your SQL requests now...\"\n Tasks: 9 (limit: 1133)\n Memory: 86.2M\n CPU: 2.201s\n CGroup: \/system.slice\/mariadb.service\n \u2514\u25003516 \/usr\/sbin\/mariadbd\n\nAug 21 08:49:47 debian11.kifarunix-demo.com \/etc\/mysql\/debian-start[3536]: Phase 6\/7: Checking and upgrading tables\nAug 21 08:49:47 debian11.kifarunix-demo.com \/etc\/mysql\/debian-start[3536]: Processing databases\nAug 21 08:49:47 debian11.kifarunix-demo.com \/etc\/mysql\/debian-start[3536]: information_schema\nAug 21 08:49:47 debian11.kifarunix-demo.com \/etc\/mysql\/debian-start[3536]: performance_schema\nAug 21 08:49:47 debian11.kifarunix-demo.com \/etc\/mysql\/debian-start[3536]: sys\nAug 21 08:49:47 debian11.kifarunix-demo.com \/etc\/mysql\/debian-start[3536]: sys.sys_config OK\nAug 21 08:49:47 debian11.kifarunix-demo.com \/etc\/mysql\/debian-start[3536]: Phase 7\/7: Running 'FLUSH PRIVILEGES'\nAug 21 08:49:47 debian11.kifarunix-demo.com \/etc\/mysql\/debian-start[3536]: OK\nAug 21 08:49:47 debian11.kifarunix-demo.com \/etc\/mysql\/debian-start[4552]: Checking for insecure root accounts.\nAug 21 08:49:47 debian11.kifarunix-demo.com \/etc\/mysql\/debian-start[4556]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables\n<\/code><\/pre>\n\n\n\n
systemctl restart mariadb<\/code><\/pre>\n\n\n\n
systemctl stop mariadb<\/code><\/pre>\n\n\n\n
systemctl disable mariadb<\/code><\/pre>\n\n\n\n
Securing MariaDB 10.6<\/h3>\n\n\n\n
mysql_secure_installation <\/code><\/strong>that is used to improve the security of MariaDB installation by:<\/p>\n\n\n\n
\n
mysql_secure_installation<\/code><\/pre>\n\n\n\n
MariaDB Authentication<\/h3>\n\n\n\n
root@localhost<\/code><\/strong> and
mysql@localhost<\/strong><\/code>.<\/p>\n\n\n\n
unix_socket<\/code><\/strong> and the
mysql_native_password<\/code><\/strong> authentication plugins.<\/p>\n\n\n\n
unix_socket<\/strong><\/code> authentication plugin allows a system
root<\/code> user or a
user with sudo rights<\/strong><\/code> to login as
root@locahost<\/strong><\/code> to MariaDB database without a password.<\/p>\n\n\n\n
unix_socket<\/strong><\/code> authentication plugin, while being a root user, you can simply login by running either of the commands below;<\/p>\n\n\n\n
mysql<\/code><\/pre>\n\n\n\n
mysql -u root<\/code><\/pre>\n\n\n\n
mysql -u root -p<\/strong><\/code>, and press ENTER for blank password, you will still login.<\/p>\n\n\n\n
sudo<\/strong><\/code>.<\/p>\n\n\n\n
Enable MariaDB password Authentication<\/h3>\n\n\n\n
mysql_native_password<\/code> plugin is used as a failover for the
unix_socket<\/code> plugin. However, the account has an invalid password. To enable password authentication, you need to login to MariaDB as root user as shown above and set the password.<\/p>\n\n\n\n
mysql<\/code><\/pre>\n\n\n\n
set password = password(\"P@sSw0Rd123\");<\/code><\/pre>\n\n\n\n
flush privileges;\nquit<\/code><\/pre>\n\n\n\n
koromicha@debian:~$ mysql -u root -p\nEnter password: ENTER PASSWORD<\/code><\/pre>\n\n\n\n
\nWelcome to the MariaDB monitor. Commands end with ; or \\g.\nYour MariaDB connection id is 57\nServer version: 10.6.4-MariaDB-1:10.6.4+maria~bullseye mariadb.org binary distribution\n\nCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\n\nMariaDB [(none)]>\n<\/code><\/pre>\n\n\n\n
sudo -u mysql mysql<\/code><\/pre>\n\n\n\n
Set Native Password Authentication Method as Default<\/h4>\n\n\n\n
unix_socke<\/code>t authentication plugin and instead use the
msqyl_native_password<\/code> authentication method, simply login to MariaDB and change the authentication plugin for root<\/strong> user.<\/p>\n\n\n\n
mysql<\/code><\/pre>\n\n\n\n
ALTER USER root@localhost IDENTIFIED VIA mysql_native_password USING PASSWORD(\"MyPQQSSword\");<\/code><\/pre>\n\n\n\n
flush privileges;\nquit<\/code><\/pre>\n\n\n\n
sudo mysql -u root<\/code><\/pre>\n\n\n\n
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)<\/code><\/pre>\n\n\n\n
Other Tutorials<\/h3>\n\n\n\n