{"id":12163,"date":"2022-04-09T10:19:00","date_gmt":"2022-04-09T07:19:00","guid":{"rendered":"https:\/\/kifarunix.com\/?p=12163"},"modified":"2024-03-09T12:11:16","modified_gmt":"2024-03-09T09:11:16","slug":"install-mariadb-10-8-on-ubuntu","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-mariadb-10-8-on-ubuntu\/","title":{"rendered":"Install MariaDB 10.8 on Ubuntu 20.04"},"content":{"rendered":"\n<p>Follow through this guide to learn how to install MariaDB 10.8 on Ubuntu 20.04. MariaDB 10.8.2 is the current RC <a href=\"https:\/\/mariadb.org\/mariadb\/all-releases\/\" target=\"_blank\" rel=\"noreferrer noopener\">release<\/a> version of MariaDB.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Install MariaDB 10.8 on Ubuntu 20.04<\/h2>\n\n\n\n<p><em>(DO NOT USE RC RELEASES IN PRODUCTION yet)<\/em><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Install MariaDB APT Repositories<\/h3>\n\n\n\n<p>To install MariDB APT repos, head over to&nbsp;<a href=\"https:\/\/downloads.mariadb.org\/mariadb\/repositories\" target=\"_blank\" rel=\"noreferrer noopener\">MariaDB repositories site<\/a>&nbsp;to choose your mirrors.<\/p>\n\n\n\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/04\/mariadb-10.8.rc_.png\" class=\"td-modal-image\"><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1082\" height=\"948\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/04\/mariadb-10.8.rc_.png\" alt=\"Install MariaDB 10.8 on Ubuntu 20.04\" class=\"wp-image-12165\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/04\/mariadb-10.8.rc_.png 1082w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/04\/mariadb-10.8.rc_-768x673.png 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/04\/mariadb-10.8.rc_-150x131.png 150w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/04\/mariadb-10.8.rc_-300x263.png 300w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/04\/mariadb-10.8.rc_-696x610.png 696w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/04\/mariadb-10.8.rc_-1068x936.png 1068w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/04\/mariadb-10.8.rc_-479x420.png 479w\" sizes=\"(max-width: 1082px) 100vw, 1082px\" \/><\/figure><\/a><\/div>\n\n\n\n<p>Next, execute the commands below to install MariaDB APT repos on your Ubuntu 20.04 server.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install software-properties-common dirmngr apt-transport-https ca-certificates -y<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>wget -qO- https:\/\/mariadb.org\/mariadb_release_signing_key.asc |\\\n gpg --dearmor &gt; \/etc\/apt\/trusted.gpg.d\/mariadb.gpg<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \\\n'deb &#91;arch=amd64,arm64,ppc64el,s390x] https:\/\/atl.mirrors.knownhost.com\/mariadb\/repo\/10.8\/ubuntu focal main' &gt; \\\n\/etc\/apt\/sources.list.d\/mariadb.list<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Install MariaDB 10.8 on Ubuntu 20.04<\/h3>\n\n\n\n<p>Run system update and install MariaDB 10.8;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install mariadb-server mariadb-client -y<\/code><\/pre>\n\n\n\n<p>You can check the version of installed MariaDB using the command;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql -V<\/code><\/pre>\n\n\n\n<p>Sample output;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql  Ver 15.1 Distrib 10.8.2-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Running MariaDB 10.8 on Ubuntu 20.04<\/h3>\n\n\n\n<p>Upon installation, MariaDB is started and enabled to run on system boot;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl status mariadb<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\n\u25cf mariadb.service - MariaDB 10.8.2 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 2022-04-09 09:34:44 EAT; 8s ago\n       Docs: man:mariadbd(8)\n             https:\/\/mariadb.com\/kb\/en\/library\/systemd\/\n    Process: 39702 ExecStartPre=\/usr\/bin\/install -m 755 -o mysql -g root -d \/var\/run\/mysqld (code=exited, status=0\/SUCCESS)\n    Process: 39708 ExecStartPre=\/bin\/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0\/SUCCESS)\n    Process: 39718 ExecStartPre=\/bin\/sh -c [ ! -e \/usr\/bin\/galera_recovery ] &amp;&amp; VAR= ||   VAR=`cd \/usr\/bin\/..; \/usr\/bin\/galera_recovery`; [ $? -eq 0 ]   &amp;&amp; systemctl set-e&gt;\n    Process: 39762 ExecStartPost=\/bin\/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0\/SUCCESS)\n    Process: 39764 ExecStartPost=\/etc\/mysql\/debian-start (code=exited, status=0\/SUCCESS)\n   Main PID: 39750 (mariadbd)\n     Status: \"Taking your SQL requests now...\"\n      Tasks: 13 (limit: 2318)\n     Memory: 58.5M\n     CGroup: \/system.slice\/mariadb.service\n             \u2514\u250039750 \/usr\/sbin\/mariadbd\n\nElb 09 09:34:44 ubuntu20.04 mariadbd[39750]: 2022-04-09  9:34:44 0 [Note] InnoDB: 10.8.2 started; log sequence number 42329; transaction id 14\nElb 09 09:34:44 ubuntu20.04 mariadbd[39750]: 2022-04-09  9:34:44 0 [Note] InnoDB: Loading buffer pool(s) from \/var\/lib\/mysql\/ib_buffer_pool\nElb 09 09:34:44 ubuntu20.04 mariadbd[39750]: 2022-04-09  9:34:44 0 [Note] Plugin 'FEEDBACK' is disabled.\nElb 09 09:34:44 ubuntu20.04 mariadbd[39750]: 2022-04-09  9:34:44 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.\nElb 09 09:34:44 ubuntu20.04 mariadbd[39750]: 2022-04-09  9:34:44 0 [Note] InnoDB: Buffer pool(s) load completed at 220409  9:34:44\nElb 09 09:34:44 ubuntu20.04 mariadbd[39750]: 2022-04-09  9:34:44 0 [Note] Server socket created on IP: '127.0.0.1'.\nElb 09 09:34:44 ubuntu20.04 mariadbd[39750]: 2022-04-09  9:34:44 0 [Note] \/usr\/sbin\/mariadbd: ready for connections.\nElb 09 09:34:44 ubuntu20.04 mariadbd[39750]: Version: '10.8.2-MariaDB-1:10.8.2+maria~focal'  socket: '\/run\/mysqld\/mysqld.sock'  port: 3306  mariadb.org binary distribution\nElb 09 09:34:44 ubuntu20.04 systemd[1]: Started MariaDB 10.8.2 database server.\n<\/code><\/pre>\n\n\n\n<p>You can manage the service via systemctl command.<\/p>\n\n\n\n<p>For example, to stop MariaDB service;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl restart mariadb<\/code><\/pre>\n\n\n\n<p>To stop the service;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl stop mariadb<\/code><\/pre>\n\n\n\n<p>Disable the service from running on system boot;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl disable mariadb<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Securing MariaDB 10.8<\/h3>\n\n\n\n<p>MariaDB comes with a default security script,&nbsp;<strong><code>mysql_secure_installation&nbsp;<\/code><\/strong>that is used to improve the security of MariaDB installation by:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Setting the password for root accounts (if need be).<\/li>\n\n\n\n<li>Disabling remote root login to the databases.<\/li>\n\n\n\n<li>Removing anonymous-user accounts.<\/li>\n\n\n\n<li>Removing the test database, which by default can be accessed by anonymous users.<\/li>\n<\/ul>\n\n\n\n<p>Simply run the command below to launch the script.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>mysql_secure_installation<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">MariaDB Authentication<\/h3>\n\n\n\n<p>The new installations of MariaDB have two secure accounts are created during the installation.<\/p>\n\n\n\n<p>The accounts are&nbsp;<strong><code>root@localhost<\/code><\/strong>&nbsp;and&nbsp;<code><strong>mysql@localhost<\/strong><\/code>.<\/p>\n\n\n\n<p>Both accounts uses either of the&nbsp;<strong><code>unix_socket<\/code><\/strong>&nbsp;and the&nbsp;<strong><code>mysql_native_password<\/code><\/strong>&nbsp;authentication plugins.<\/p>\n\n\n\n<p><code><strong>unix_socket<\/strong><\/code>&nbsp;authentication plugin allows a system&nbsp;<code>root<\/code>&nbsp;user or a&nbsp;<code><strong>user with sudo rights<\/strong><\/code>&nbsp;to login as&nbsp;<code><strong>root@locahost<\/strong><\/code>&nbsp;to MariaDB database without a password.<\/p>\n\n\n\n<p>With&nbsp;<code><strong>unix_socket<\/strong><\/code>&nbsp;authentication plugin, while being a root user, you can simply login by running either of the commands below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>mysql<\/code><\/pre>\n\n\n\n<p>or<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>mysql -u root<\/code><\/pre>\n\n\n\n<p>Even if you run,&nbsp;<code><strong>mysql -u root -p<\/strong><\/code>, and press ENTER for blank password, you will still login.<\/p>\n\n\n\n<p>As a user with sudo rights, prefix the commands above with&nbsp;<code><strong>sudo<\/strong><\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Enable MariaDB password Authentication (<em>this doesnt disable passwordless authentication for root and sudo user<\/em>)<\/h3>\n\n\n\n<p>The&nbsp;<code>mysql_native_password<\/code>&nbsp;plugin is used as a failover for the&nbsp;<code>unix_socket<\/code>&nbsp;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<pre class=\"wp-block-code\"><code>mysql<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>set password = password(\"P@sSw0Rd123\");<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>flush privileges;\nquit<\/code><\/pre>\n\n\n\n<p>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<pre class=\"wp-block-preformatted\"><code>koromicha@ubuntu20.-04:~$ <strong>mysql -u root -p<\/strong>\nEnter password: ENTER PASSWORD<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>Welcome to the MariaDB monitor.  Commands end with ; or \\g.\nYour MariaDB connection id is 37\nServer version: 10.8.2-MariaDB-1:10.8.2+maria~focal 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)]&gt;\n<\/code><\/pre>\n\n\n\n<p>Similarly, you can login as mysql user;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo -u mysql mysql<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Set Native Password Authentication Method as Default<\/h4>\n\n\n\n<p>To completely disable&nbsp;<code>unix_socket<\/code> authentication plugin and instead use the&nbsp;<code>msqyl_native_password<\/code>&nbsp;authentication method, simply login to MariaDB and change the authentication plugin for&nbsp;<strong>root<\/strong>&nbsp;user.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>ALTER USER root@localhost IDENTIFIED VIA mysql_native_password USING PASSWORD(\"MyPQQSSword\");<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>flush privileges;\nquit<\/code><\/pre>\n\n\n\n<p>Next time you try to login without specifying the password, login will fail.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mysql -u root<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)<\/code><\/pre>\n\n\n\n<p>That marks the end of our guide on how to install MariaDB 10.8 on Ubuntu.<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-mariadb-10-x-on-rocky-linux-8\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install MariaDB 10.x on Rocky Linux 8<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-and-run-mariadb-as-a-docker-container\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install and Run MariaDB as a Docker Container<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-request-tracker-rt-with-mariadb-on-centos-8\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install Request Tracker (RT) with MariaDB on CentOS 8<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Follow through this guide to learn how to install MariaDB 10.8 on Ubuntu 20.04. MariaDB 10.8.2 is the current RC release version of MariaDB. Install<\/p>\n","protected":false},"author":1,"featured_media":9145,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[121,299,928],"tags":[4856,4858,4859,1200,4857],"class_list":["post-12163","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","category-database","category-mariadb","tag-install-mariadb-10-8-ubuntu-20-04","tag-mariadb-10-8","tag-mariadb-install","tag-ubuntu-20-04","tag-ubuntu-20-04-mariadb-10-8","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/12163"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=12163"}],"version-history":[{"count":3,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/12163\/revisions"}],"predecessor-version":[{"id":20473,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/12163\/revisions\/20473"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/9145"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=12163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=12163"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=12163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}