{"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
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<\/a> version of MariaDB.<\/p>\n\n\n\n (DO NOT USE RC RELEASES IN PRODUCTION yet)<\/em><\/p>\n\n\n\n To install MariDB APT repos, head over to MariaDB repositories site<\/a> to choose your mirrors.<\/p>\n\n\n\n Next, execute the commands below to install MariaDB APT repos on your Ubuntu 20.04 server.<\/p>\n\n\n\n Run system update and install MariaDB 10.8;<\/p>\n\n\n\n You can check the version of installed MariaDB using the command;<\/p>\n\n\n\n Sample output;<\/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 10.8 on Ubuntu.<\/p>\n\n\n\n Install MariaDB 10.x on Rocky Linux 8<\/a><\/p>\n\n\n\n Install and Run MariaDB as a Docker Container<\/a><\/p>\n\n\n\nInstall MariaDB 10.8 on Ubuntu 20.04<\/h2>\n\n\n\n
Install MariaDB APT Repositories<\/h3>\n\n\n\n
<\/figure><\/a><\/div>\n\n\n\n
apt update<\/code><\/pre>\n\n\n\n
apt install software-properties-common dirmngr apt-transport-https ca-certificates -y<\/code><\/pre>\n\n\n\n
wget -qO- https:\/\/mariadb.org\/mariadb_release_signing_key.asc |\\\n gpg --dearmor > \/etc\/apt\/trusted.gpg.d\/mariadb.gpg<\/code><\/pre>\n\n\n\n
echo \\\n'deb [arch=amd64,arm64,ppc64el,s390x] https:\/\/atl.mirrors.knownhost.com\/mariadb\/repo\/10.8\/ubuntu focal main' > \\\n\/etc\/apt\/sources.list.d\/mariadb.list<\/code><\/pre>\n\n\n\n
Install MariaDB 10.8 on Ubuntu 20.04<\/h3>\n\n\n\n
apt update<\/code><\/pre>\n\n\n\n
apt install mariadb-server mariadb-client -y<\/code><\/pre>\n\n\n\n
mysql -V<\/code><\/pre>\n\n\n\n
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
Running MariaDB 10.8 on Ubuntu 20.04<\/h3>\n\n\n\n
systemctl status mariadb<\/code><\/pre>\n\n\n\n
\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 ] && VAR= || VAR=`cd \/usr\/bin\/..; \/usr\/bin\/galera_recovery`; [ $? -eq 0 ] && systemctl set-e>\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
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.8<\/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 (this doesnt disable passwordless authentication for root and sudo user<\/em>)<\/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@ubuntu20.-04:~$ mysql -u root -p<\/strong>\nEnter password: ENTER PASSWORD<\/code><\/pre>\n\n\n\n
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)]>\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_socket<\/code> 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