{"id":3540,"date":"2019-07-06T13:46:42","date_gmt":"2019-07-06T10:46:42","guid":{"rendered":"https:\/\/kifarunix.com\/?p=3540"},"modified":"2019-09-10T16:46:38","modified_gmt":"2019-09-10T13:46:38","slug":"install-mariadb-10-4-on-ubuntu-18-04-debian-9","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-mariadb-10-4-on-ubuntu-18-04-debian-9\/","title":{"rendered":"Install MariaDB 10.4 on Ubuntu 18.04\/Debian 9"},"content":{"rendered":"\n<p>This guide demonstrates how to install MariaDB 10.4 on Ubuntu 18.04\/Debian 9. <a rel=\"noreferrer noopener\" aria-label=\"MariaDB 10.4.6 (opens in a new tab)\" href=\"https:\/\/downloads.mariadb.org\/mariadb\/10.4.6\/\" target=\"_blank\">MariaDB 10.4.6<\/a> is the latest stable release as of this writing.<\/p>\n\n\n\n<p>MariaDB 10.4 has come with a whole lot <a href=\"https:\/\/mariadb.com\/kb\/en\/library\/changes-improvements-in-mariadb-104\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"changes and improvements (opens in a new tab)\">changes and improvements<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Install MariaDB 10.4 on Ubuntu 18.04\/Debian 9<\/h2>\n\n\n\n<p>To install MariaDB 10.4, we are going to use MariaDB APT repo. This repo is not available by default on Ubuntu 18.04 systems. Hence, you need to create it.<\/p>\n\n\n\n<p>Update and upgrade your system packages.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt update\napt upgrade<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Create MariaDB APT Repo<\/h3>\n\n\n\n<p>To create MariaDB APT repo, you can use the <strong>add-apt-repository<\/strong> command. However, this command is not available by default and ence, you need to first install the <strong>software-properties-common<\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt install software-properties-common<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Import MariaDB APT Repo GPG Signing Key<\/h3>\n\n\n\n<p>Note that on Debian 9, you need to install the <strong>dirmngr<\/strong> package before you can import the GPG public key. dirmngr is used for managing and downloading OpenPGP and X.509 certificates.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt install dirmngr<\/code><\/pre>\n\n\n\n<p>Next, run the command below to import MariaDB APT repo GPG signing key.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo apt-key adv --recv-keys --keyserver hkp:\/\/keyserver.ubuntu.com:80 0xF1656F24C74CD1D8<\/code><\/pre>\n\n\n\n<p>On Ubuntu 18.04, you can now create MariaDB 10.4 repo as shown below.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http:\/\/sfo1.mirrors.digitalocean.com\/mariadb\/repo\/10.4\/ubuntu bionic main'<\/code><\/pre>\n\n\n\n<p>On Debian 9, you can create MariaDB 10.4 repo by running the command below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http:\/\/mirror.zol.co.zw\/mariadb\/repo\/10.4\/debian stretch main'<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Run System Update<\/h3>\n\n\n\n<p>Before you can install MariaDB 10.4, update the system package cache by executing the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt update\napt upgrade<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Install MariaDB 10.4 on Ubuntu 18.04\/Debian 9<\/h3>\n\n\n\n<p>To install MariaDB 10.4 server and client, run the command below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt install mariadb-server mariadb-client<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Running MariaDB 10.4<\/h3>\n\n\n\n<p>After installation, MariaDB started by default. It is also set to run on system boot by default.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl status mariadb.service\n\u25cf mariadb.service - MariaDB 10.4.6 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 2019-07-06 11:41:39 EAT; 41s ago\n     Docs: man:mysqld(8)\n           https:\/\/mariadb.com\/kb\/en\/library\/systemd\/\n Main PID: 11660 (mysqld)\n   Status: \"Taking your SQL requests now...\"\n    Tasks: 32 (limit: 2340)\n   CGroup: \/system.slice\/mariadb.service\n           \u2514\u250011660 \/usr\/sbin\/mysqld<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl is-enabled mariadb.service\nenabled<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">MariaDB 10.4 Authentication<\/h2>\n\n\n\n<p>MariaDB 10.4 comes with a lot of security changes with the <strong>root@localhost<\/strong> user account being secured by default. The fact that you were supposed to set and remember the password of MariaDB server root user password no longer exists.<\/p>\n\n\n\n<p>The&nbsp;<code>root@localhost<\/code>&nbsp;user created with the ability to either use;<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>the&nbsp;<code>unix_socket<\/code>&nbsp;authentication plugin. This allows the the&nbsp;<code>root@localhost<\/code>&nbsp;user to login without a password via the local Unix socket  as long as the login is attempted from a process owned by the operating system&nbsp;<code>root<\/code> user account.<\/li><li>use the&nbsp;<code>mysql_native_password<\/code>&nbsp;authentication plugin if <code>unix_socket<\/code>&nbsp;authentication plugin fails. An invalid password is however initially set and thus, you need to set the password with the usual&nbsp;<code>SET PASSWORD<\/code> statement before this method can work.<\/li><\/ul>\n\n\n\n<p>As a result, you can simply login to MariaDB 10.4 by just using <strong>mysql<\/strong> or <strong>mysql -u root<\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql -u root\nWelcome to the MariaDB monitor.  Commands end with ; or \\g.\nYour MariaDB connection id is 50\nServer version: 10.4.6-MariaDB-1:10.4.6+maria~bionic-log 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)]><\/code><\/pre>\n\n\n\n<p>To enable Password authentication for <strong>root@localhost<\/strong> user account, simply run the MariaDB initial security script and switch to <code>unix_socket<\/code> authentication.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>mysql_secure_installation<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>...\nSetting the root password or using the unix_socket ensures that nobody\ncan log into the MariaDB root user without the proper authorisation.\n\nYou already have your root account protected, so you can safely answer 'n'.\n\nSwitch to unix_socket authentication [Y\/n] y\nEnabled successfully!\nReloading privilege tables..\n ... Success!\n...<\/code><\/pre>\n\n\n\n<p>Next, \u00a0revert to the old\u00a0<code><a href=\"https:\/\/mariadb.com\/kb\/en\/authentication-plugin-mysql_native_password\/\" target=\"_blank\" rel=\"noopener\">mysql_native_password<\/a><\/code>\u00a0authentication method for the user account by executing the following:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>mysql -u root<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>ALTER USER root@localhost IDENTIFIED VIA mysql_native_password USING PASSWORD(\"P@SSWORD\");<\/code><\/pre>\n\n\n\n<p>Login to MariaDB now requires password.<\/p>\n\n\n\n<p>Read more about MariaDB 10.4 authentications <a rel=\"noreferrer noopener\" aria-label=\"here (opens in a new tab)\" href=\"https:\/\/mariadb.com\/kb\/en\/library\/authentication-from-mariadb-104\/\" target=\"_blank\">here<\/a>.<\/p>\n\n\n\n<p>Well, that is on how to install MariaDB 10.4 on Ubuntu 18.04\/Debian 9.<\/p>\n\n\n\n<p>You can check our related tutorials by following the links below;<\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/install-mysql-8-on-freebsd-12\/\" target=\"_blank\">Install MySQL 8 on FreeBSD 12<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-mysql-8-on-debian-9\/\">Install MySQL 8 on Debian 9<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-mysql-8-on-fedora-30-fedora-29\/\">Install MySQL 8 on Fedora 30\/Fedora 29<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-lemp-stack-with-mysql-8-on-fedora-30-fedora-29\/\">Install LEMP Stack with MySQL 8 on Fedora 30\/Fedora 29<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This guide demonstrates how to install MariaDB 10.4 on Ubuntu 18.04\/Debian 9. MariaDB 10.4.6 is the latest stable release as of this writing. MariaDB 10.4<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[299,121,928],"tags":[1000,287,136,1024,67],"class_list":["post-3540","post","type-post","status-publish","format-standard","hentry","category-database","category-howtos","category-mariadb","tag-database","tag-debian-9","tag-mariadb","tag-mariadb-10-4","tag-ubuntu-18-04","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/3540"}],"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=3540"}],"version-history":[{"count":6,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/3540\/revisions"}],"predecessor-version":[{"id":4150,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/3540\/revisions\/4150"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=3540"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=3540"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=3540"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}