{"id":4348,"date":"2019-10-04T08:23:13","date_gmt":"2019-10-04T05:23:13","guid":{"rendered":"https:\/\/kifarunix.com\/?p=4348"},"modified":"2024-03-12T22:27:28","modified_gmt":"2024-03-12T19:27:28","slug":"install-mariadb-10-4-on-centos-8","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-mariadb-10-4-on-centos-8\/","title":{"rendered":"Install MariaDB 10.4 on CentOS 8"},"content":{"rendered":"\n<p>This guide will take you through how to install MariaDB 10.4 on CentOS 8  system. As of this writing, MariaDB 10.4 is the current&nbsp;<strong>stable<\/strong>&nbsp;(GA) series of MariaDB.&nbsp;You can read more about <a rel=\"noreferrer noopener\" aria-label=\"MariaDB 10.4 features (opens in a new tab)\" href=\"https:\/\/mariadb.com\/kb\/en\/library\/changes-improvements-in-mariadb-104\/\" target=\"_blank\">MariaDB 10.4 features<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing MariaDB 10.4 on CentOS 8<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Install MariaDB 10.4 YUM Repository<\/h3>\n\n\n\n<p>The default CentOS 8 AppStream repo contains MariadDB 10.3 (As of this writing). To install MariaDB 10.4, you need to install its YUM repository.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cat &lt;&lt; EOF &gt; \/etc\/yum.repos.d\/mariadb.repo\n&#91;mariadb]\nname = MariaDB-10.4\nbaseurl=http:\/\/yum.mariadb.org\/10.4\/centos8-amd64\ngpgkey=https:\/\/yum.mariadb.org\/RPM-GPG-KEY-MariaDB\ngpgcheck=1\nEOF<\/code><\/pre>\n\n\n\n<p>Next, install MariaDB YUM repository signing key.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>rpm --import https:\/\/yum.mariadb.org\/RPM-GPG-KEY-MariaDB<\/code><\/pre>\n\n\n\n<p>Update your system<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf update<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Install MariaDB 10.4<\/h3>\n\n\n\n<p>To install MariaDB 10.4 from the repos created above, you need to disable to AppStream repos which provides MariaDB 10.3 packages.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf --disablerepo=AppStream install MariaDB-server MariaDB-client<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>Dependencies resolved.\n=======================================================================================================================================================\n Package                               Arch                          Version                                      Repository                      Size\n=======================================================================================================================================================\nInstalling:\n MariaDB-client                        x86_64                        10.4.8-1.el8                                 mariadb                         12 M\n MariaDB-server                        x86_64                        10.4.8-1.el8                                 mariadb                         26 M\nInstalling dependencies:\n MariaDB-common                        x86_64                        10.4.8-1.el8                                 mariadb                         87 k\n galera-4                              x86_64                        26.4.2-1.rhel8.0.el8                         mariadb                         13 M\n\nTransaction Summary\n=======================================================================================================================================================\nInstall  4 Packages\n\nTotal download size: 51 M\nInstalled size: 196 M\nIs this ok [y\/N]:y<\/code><\/pre>\n\n\n\n<p>If, for some reasons, during the installation you get the error;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><strong>Error: \n Problem: package MariaDB-server-10.4.11-1.el8.x86_64 requires galera-4, but none of the providers can be installed\n  - cannot install the best candidate for the job\n  - nothing provides libboost_program_options.so.1.66.0()(64bit) needed by galera-4-26.4.3-1.rhel8.0.el8.x86_64\n(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)<\/strong><\/code><\/pre>\n\n\n\n<p><strong>Simply install galera-4 package before running the MariaDB 10.4 installation command above<\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf install galera-4<\/code><\/pre>\n\n\n\n<p>After that, rerun the MariaDB installation command;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf --disablerepo=AppStream install MariaDB-server MariaDB-client<\/code><\/pre>\n\n\n\n<p>During the installation, two privileged MariaDB 10.4 user accounts are created.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>One is <strong><code>root@localhost<\/code><\/strong>, it has no password, but you need to be system &#8216;root&#8217; user to connect e.g <code>sudo mysql<\/code><\/li>\n\n\n\n<li> The other is <code>mysql@localhost<\/code>, it has no password either, but you need to be the system &#8216;mysql&#8217; user to connect.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Running MariaDB<\/h3>\n\n\n\n<p>To start MariaDB;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl start mariadb<\/code><\/pre>\n\n\n\n<p>To enable MariaDB to run on system boot;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl enable mariadb<\/code><\/pre>\n\n\n\n<p>To check the status of MariaDB;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl status mariadb<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>\u25cf mariadb.service - MariaDB 10.4.8 database server\n   Loaded: loaded (\/usr\/lib\/systemd\/system\/mariadb.service; enabled; vendor preset: disabled)\n  Drop-In: \/etc\/systemd\/system\/mariadb.service.d\n           \u2514\u2500migrated-from-my.cnf-settings.conf\n   Active: active (running) since Thu 2019-10-03 16:08:26 EDT; 1min 45s ago\n     Docs: man:mysqld(8)\n           https:\/\/mariadb.com\/kb\/en\/library\/systemd\/\n Main PID: 10019 (mysqld)\n   Status: \"Taking your SQL requests now...\"\n    Tasks: 30 (limit: 11521)\n   Memory: 101.9M\n   CGroup: \/system.slice\/mariadb.service\n           \u2514\u250010019 \/usr\/sbin\/mysqld<\/code><\/pre>\n\n\n\n<p>Verify the MariaDB installed version.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>mysql -V<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>mysql  Ver 15.1 Distrib 10.4.8-MariaDB, for Linux (x86_64) using readline 5.1<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Securing MariaDB<\/h3>\n\n\n\n<p>MariaDB comes with a default security script, <strong><code>mysql_secure_installation <\/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.<\/li>\n\n\n\n<li>Removing root accounts that are accessible from outside the local host.<\/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 10.4 Authentication<\/h3>\n\n\n\n<p>As stated above, two secure accounts are created during the installation of MariaDB 10.4. The <strong><code>root@localhost<\/code><\/strong> uses both the <strong><code>unix_socket<\/code><\/strong> and the <strong><code>mysql_native_password<\/code><\/strong> authentication plugins.<\/p>\n\n\n\n<p>Unix_socket plugins works when connection to MariaDB is made from the localhost as a root user. You can simply login running the command (as root or with sudo);<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>mysql<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>mysql -u root<\/code><\/pre>\n\n\n\n<p>The <code>mysql_native_password<\/code> plugin is used as a failover for the unix_socket 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-preformatted\"><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<p>This re-enables the MariaDB password authentication.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Set Native Password Authentication Method as Default<\/h3>\n\n\n\n<p>If you need to change the <code>unix_socke<\/code>t plugin authentication to the <code>msqyl_native_password<\/code> authentication method, simply login to MariaDB and change the authentication plugin for root user.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>mysql<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>ALTER USER root@localhost IDENTIFIED VIA mysql_native_password USING PASSWORD(\"MyPQQSSword\");<\/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-preformatted\"><code>sudo mysql -u root<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)<\/code><\/pre>\n\n\n\n<p>Read more about authentications on <a href=\"https:\/\/mariadb.com\/kb\/en\/library\/authentication-from-mariadb-104\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"MariaDB 10.4 Authentication (opens in a new tab)\">MariaDB 10.4 Authentication<\/a>.<\/p>\n\n\n\n<p>That is all on our guide on how to install MariaDB 10.4.<\/p>\n\n\n\n<p>You can check our other guides on MariaDB\/MySQL installations 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-mariadb-10-on-debian-10-buster\/\" target=\"_blank\">Install MariaDB 10 on Debian 10 Buster<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/install-mariadb-10-4-on-ubuntu-18-04-debian-9\/\" target=\"_blank\">Install MariaDB 10.4 on Ubuntu 18.04\/Debian 9<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/install-mariadb-10-3-on-centos-7\/\" target=\"_blank\">Install MariaDB 10.3 on CentOS 7<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-mariadb-10-3-on-fedora-30\/\">Install MariaDB 10.3 on <\/a><a href=\"https:\/\/kifarunix.com\/install-mariadb-10-3-on-fedora-30\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Fedora (opens in a new tab)\">Fedora<\/a><a href=\"https:\/\/kifarunix.com\/install-mariadb-10-3-on-fedora-30\/\"> 30<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-mysql-8-on-centos-8\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Install MySQL 8 on CentOS 8<\/a><\/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-debian-10-buster\/\" target=\"_blank\">Install MySQL 8 on Debian 10 Buster<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This guide will take you through how to install MariaDB 10.4 on CentOS 8 system. As of this writing, MariaDB 10.4 is the current&nbsp;stable&nbsp;(GA) series<\/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":[121,299,928],"tags":[1142,136,1024,1143],"class_list":["post-4348","post","type-post","status-publish","format-standard","hentry","category-howtos","category-database","category-mariadb","tag-centos-8","tag-mariadb","tag-mariadb-10-4","tag-rdbms","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/4348"}],"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=4348"}],"version-history":[{"count":6,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/4348\/revisions"}],"predecessor-version":[{"id":21236,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/4348\/revisions\/21236"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=4348"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=4348"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=4348"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}