{"id":7465,"date":"2018-05-28T14:31:35","date_gmt":"2018-05-28T06:31:35","guid":{"rendered":"http:\/\/rmohan.com\/?p=7465"},"modified":"2018-05-28T14:31:35","modified_gmt":"2018-05-28T06:31:35","slug":"installing-mariadb-on-centos-linux-7-5","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=7465","title":{"rendered":"Installing MariaDB on CentOS Linux 7.5"},"content":{"rendered":"<p><span>MariaDB is an open source relational database management system that is backwards compatible and replaces MySQL with binary.\u00a0It was developed by some of MySQL&#8217;s original developers and many in the community.\u00a0With\u00a0the release\u00a0of\u00a0<\/span><a title=\"CentOS\" href=\"https:\/\/www.linuxidc.com\/topicnews.aspx?tid=14\" target=\"_blank\" rel=\"noopener\"><span>CentOS<\/span><\/a><span>\u00a07, MySQL was replaced by MariaDB as the default database system.<\/span><\/p>\n<p><span>If for any reason you need to install MySQL, check out how to install MySQL on the CentOS 7 tutorial.\u00a0If your application does not have any specific requirements, you should stick with MariaDB, the default database system in CentOS 7.<\/span><\/p>\n<p><span>In this tutorial, we will show you how to install the latest version of MariaDB on CentOS 7 using the official MariaDB repository.\u00a0The MariaDB server version provided in the default CentOS repository is version 5.5 and is not the latest stable version of MariaDB.<\/span><\/p>\n<p><strong><span>Install MariaDB<\/span><\/strong><\/p>\n<p><span>At the time of this writing, the latest version of MariaDB is version 10.3.<\/span><\/p>\n<p><span>Create a repository file called MariaDB.repo and add the following:<\/span><\/p>\n<p><span>\/etc\/yum.repos.d\/MariaDB.repo<\/span><\/p>\n<p><span># MariaDB 10.3 CentOS repository list &#8211; created 2018-05-27 07:02 UTC\u00a0<\/span><br \/>\n<span># http:\/\/downloads.mariadb.org\/mariadb\/repositories\/\u00a0<\/span><br \/>\n<span>[mariadb]\u00a0<\/span><br \/>\n<span>name = MariaDB\u00a0<\/span><br \/>\n<span>baseurl = http:\/\/yum.mariadb.org\/ 10.3\/centos7-amd64\u00a0<\/span><br \/>\n<span>gpgkey=https:\/\/yum.mariadb.org\/RPM-GPG-KEY-MariaDB\u00a0<\/span><br \/>\n<span>gpgcheck=1<\/span><\/p>\n<p><span>If you need to install any other version of MariaDB, generate a repository for your desired version of MariaDB on this page (https:\/\/downloads.mariadb.org\/mariadb\/repositories\/).<\/span><\/p>\n<p><span>We will use yum to install the MariaDB server and client packages, just like other CentOS packages, by typing the following command:<\/span><\/p>\n<p><span>Sudo yum install MariaDB-server MariaDB-client<\/span><\/p>\n<p><span>Yum may prompt you to import the MariaDB GPG key:<\/span><\/p>\n<p><span>Retrieving key from https:\/\/yum.mariadb.org\/RPM-GPG-KEY-MariaDB\u00a0<\/span><br \/>\n<span>Importing GPG key 0x1BB943DB:\u00a0<\/span><br \/>\n<span>Userid : &#8220;MariaDB Package Signing Key &lt;package-signing-key@mariadb.org&gt;&#8221;\u00a0<\/span><br \/>\n<span>Fingerprint: 1993 69e5 404b d5fc 7d2f e43b cbcb 082a 1bb9 43db\u00a0<\/span><br \/>\n<span>From : https:\/\/yum.mariadb.org\/RPM-GPG-KEY-MariaDB<\/span><\/p>\n<p><span>Type y and press Enter.<\/span><\/p>\n<p><strong><span>After the installation is complete, enable and start the MariaDB service:<\/span><\/strong><\/p>\n<p><span>Sudo systemctl enable mariadb\u00a0<\/span><br \/>\n<span>sudo systemctl start mariadb<\/span><\/p>\n<p><span>Once the MySQL service starts, we can check its status by entering the following:<\/span><\/p>\n<p><span>Sudo systemctl status mariadb<\/span><\/p>\n<p><span>Sample output:<\/span><\/p>\n<p><span>? mariadb.service &#8211; MariaDB 10.3.7 database server\u00a0<\/span><br \/>\n<span>\u00a0 Loaded: loaded (\/usr\/lib\/systemd\/system\/mariadb.service; enabled; vendor preset: disabled)\u00a0<\/span><br \/>\n<span>\u00a0 Drop-In: \/etc\/systemd\/system\/mariadb.service. d\u00a0<\/span><br \/>\n<span>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 ??migrated-from-my.cnf-settings.conf\u00a0<\/span><br \/>\n<span>\u00a0 Active: inactive (dead)\u00a0<\/span><br \/>\n<span>\u00a0 \u00a0 Docs: man:mysqld(8)\u00a0<\/span><br \/>\n<span>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 https:\/\/mariadb.com\/kb\/en\/library\/systemd\/<\/span><\/p>\n<p><span>And print the MariaDB server version, which contains:<\/span><\/p>\n<p><span>Mysql -V<\/span><\/p>\n<p><span>Mysql Ver 15.1 Distrib 10.3.7-MariaDB, for Linux (x86_64) using readline 5.1<\/span><\/p>\n<p><strong><span>Protecting MariaDB security<\/span><\/strong><\/p>\n<p><span>Run the mysql_secure_installation command to improve MariaDB installation security:<\/span><\/p>\n<p><span>Sudo mysql_secure_installation<\/span><\/p>\n<p><span>The script prompts you to set the root password, remove the anonymous user, restrict the root user&#8217;s access to the local computer, and delete the test database.\u00a0All steps are detailed and it is recommended to answer &#8220;yes&#8221; (yes) to all questions.<\/span><\/p>\n<p><span>Connect to MariaDB from the command line<\/span><\/p>\n<p><span>To connect to the MariaDB server through the terminal, we will use the MariaDB client.<\/span><\/p>\n<p><span>You can log in to the MariaDB server as root by typing:<\/span><\/p>\n<p><span>Mysql -u root -p<\/span><\/p>\n<p><span>You will be prompted to enter the previously set root password when running the mysql_secure_installation script.<\/span><\/p>\n<p><span>Once you enter the password, you will see the MariaDB shell as follows:<\/span><\/p>\n<p><span>Welcome to the MariaDB monitor. Commands end with ; or \\g.\u00a0<\/span><br \/>\n<span>Your MariaDB connection id is 8\u00a0<\/span><br \/>\n<span>Server version: 10.3.7-MariaDB MariaDB Server<\/span><\/p>\n<p><span>Copyright (c) 2000, 2018,\u00a0<\/span><a title=\"Oracle\" href=\"https:\/\/www.linuxidc.com\/topicnews.aspx?tid=12\" target=\"_blank\" rel=\"noopener\"><span>Oracle<\/span><\/a><span>\u00a0, MariaDB Corporation Ab and others.<\/span><\/p>\n<p><span>Type &#8216;help;&#8217; or &#8216;\\h&#8217; for help. Type &#8216;\\c&#8217; to clear the current input statement.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>MariaDB is an open source relational database management system that is backwards compatible and replaces MySQL with binary. It was developed by some of MySQL&#8217;s original developers and many in the community. With the release of CentOS 7, MySQL was replaced by MariaDB as the default database system.<\/p>\n<p>If for any reason you need to [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7465"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7465"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7465\/revisions"}],"predecessor-version":[{"id":7466,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7465\/revisions\/7466"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7465"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7465"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7465"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}