{"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
This guide demonstrates how to install MariaDB 10.4 on Ubuntu 18.04\/Debian 9. MariaDB 10.4.6<\/a> is the latest stable release as of this writing.<\/p>\n\n\n\n MariaDB 10.4 has come with a whole lot changes and improvements<\/a>.<\/p>\n\n\n\n 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 Update and upgrade your system packages.<\/p>\n\n\n\n To create MariaDB APT repo, you can use the add-apt-repository<\/strong> command. However, this command is not available by default and ence, you need to first install the software-properties-common<\/strong>.<\/p>\n\n\n\n Note that on Debian 9, you need to install the 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 Next, run the command below to import MariaDB APT repo GPG signing key.<\/p>\n\n\n\n On Ubuntu 18.04, you can now create MariaDB 10.4 repo as shown below.<\/p>\n\n\n\n On Debian 9, you can create MariaDB 10.4 repo by running the command below;<\/p>\n\n\n\n Before you can install MariaDB 10.4, update the system package cache by executing the following command:<\/p>\n\n\n\n To install MariaDB 10.4 server and client, run the command below;<\/p>\n\n\n\n After installation, MariaDB started by default. It is also set to run on system boot by default.<\/p>\n\n\n\n MariaDB 10.4 comes with a lot of security changes with the 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 The As a result, you can simply login to MariaDB 10.4 by just using mysql<\/strong> or mysql -u root<\/strong>.<\/p>\n\n\n\n To enable Password authentication for root@localhost<\/strong> user account, simply run the MariaDB initial security script and switch to Next, \u00a0revert to the old\u00a0 Login to MariaDB now requires password.<\/p>\n\n\n\n Read more about MariaDB 10.4 authentications here<\/a>.<\/p>\n\n\n\n Well, that is on how to install MariaDB 10.4 on Ubuntu 18.04\/Debian 9.<\/p>\n\n\n\n You can check our related tutorials by following the links below;<\/p>\n\n\n\n Install MySQL 8 on FreeBSD 12<\/a><\/p>\n\n\n\n Install MySQL 8 on Debian 9<\/a><\/p>\n\n\n\nInstall MariaDB 10.4 on Ubuntu 18.04\/Debian 9<\/h2>\n\n\n\n
apt update\napt upgrade<\/code><\/pre>\n\n\n\n
Create MariaDB APT Repo<\/h3>\n\n\n\n
apt install software-properties-common<\/code><\/pre>\n\n\n\n
Import MariaDB APT Repo GPG Signing Key<\/h3>\n\n\n\n
apt install dirmngr<\/code><\/pre>\n\n\n\n
sudo apt-key adv --recv-keys --keyserver hkp:\/\/keyserver.ubuntu.com:80 0xF1656F24C74CD1D8<\/code><\/pre>\n\n\n\n
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
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
Run System Update<\/h3>\n\n\n\n
apt update\napt upgrade<\/code><\/pre>\n\n\n\n
Install MariaDB 10.4 on Ubuntu 18.04\/Debian 9<\/h3>\n\n\n\n
apt install mariadb-server mariadb-client<\/code><\/pre>\n\n\n\n
Running MariaDB 10.4<\/h3>\n\n\n\n
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
systemctl is-enabled mariadb.service\nenabled<\/code><\/pre>\n\n\n\n
MariaDB 10.4 Authentication<\/h2>\n\n\n\n
root@localhost<\/code> user created with the ability to either use;<\/p>\n\n\n\n
unix_socket<\/code> authentication plugin. This allows the the
root@localhost<\/code> 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
root<\/code> user account.<\/li>
mysql_native_password<\/code> authentication plugin if
unix_socket<\/code> authentication plugin fails. An invalid password is however initially set and thus, you need to set the password with the usual
SET PASSWORD<\/code> statement before this method can work.<\/li><\/ul>\n\n\n\n
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
unix_socket<\/code> authentication.<\/p>\n\n\n\n
mysql_secure_installation<\/code><\/pre>\n\n\n\n
...\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
mysql_native_password<\/a><\/code>\u00a0authentication method for the user account by executing the following:<\/p>\n\n\n\n
mysql -u root<\/code><\/pre>\n\n\n\n
ALTER USER root@localhost IDENTIFIED VIA mysql_native_password USING PASSWORD(\"P@SSWORD\");<\/code><\/pre>\n\n\n\n