{"id":7152,"date":"2020-10-18T08:48:34","date_gmt":"2020-10-18T05:48:34","guid":{"rendered":"https:\/\/kifarunix.com\/?p=7152"},"modified":"2024-03-14T23:24:42","modified_gmt":"2024-03-14T20:24:42","slug":"easily-install-mariadb-10-5-on-freebsd-12-1","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/easily-install-mariadb-10-5-on-freebsd-12-1\/","title":{"rendered":"Easily Install MariaDB 10.5 on FreeBSD 12.1"},"content":{"rendered":"\n<p>In this tutorial, you will how to install MariaDB 10.5 on FreeBSD 12.1. \u201c<em><a rel=\"noreferrer noopener\" href=\"https:\/\/mariadb.com\/kb\/en\/what-is-mariadb-105\/\" target=\"_blank\">MariaDB 10.5<\/a>&nbsp;is the current&nbsp;stable&nbsp;series of MariaDB. It is an evolution of&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/mariadb.com\/kb\/en\/what-is-mariadb-104\/\" target=\"_blank\">MariaDB 10.4<\/a>&nbsp;with several entirely&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/mariadb.com\/kb\/en\/changes-improvements-in-mariadb-105\/\" target=\"_blank\">new features<\/a>&nbsp;not found anywhere else and with backported and reimplemented features from MySQL\u201d<\/em>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing MariaDB 10.5 on FreeBSD 12.1<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Run System Update<\/h3>\n\n\n\n<p>Assuming that you are installing MariaDB 10.5 on a newly installed FreeBSD 12.1, update and FreeBSD package catalogue.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>pkg update<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>pkg upgrade<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"install-mariadb-10.5-from-apt-repos\">Install MariaDB 10.5<\/h3>\n\n\n\n<p>The FreeBSD 12.1 package catalogue provides the latest stable release versions of MariaDB.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>pkg search mariadb<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>mariadb-connector-c-3.1.9      MariaDB database connector for C\nmariadb-connector-odbc-3.1.9   MariaDB database connector for odbc\nmariadb103-client-10.3.24      Multithreaded SQL database (client)\nmariadb103-server-10.3.24      Multithreaded SQL database (server)\nmariadb104-client-10.4.14      Multithreaded SQL database (client)\nmariadb104-server-10.4.14      Multithreaded SQL database (server)\nmariadb105-client-10.5.5       Multithreaded SQL database (client)\nmariadb105-server-10.5.5       Multithreaded SQL database (server)<\/code><\/pre>\n\n\n\n<p>Therefore, to install MariaDB, simply execute the command below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>pkg install mariadb105-server mariadb105-client<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>The following 7 package(s) will be affected (of 0 checked):\n\nNew packages to be INSTALLED:\n\tboost-libs: 1.72.0_2\n\tgalera26: 26.4.5\n\tmariadb105-client: 10.5.5\n\tmariadb105-server: 10.5.5\n\trsync: 3.2.3\n\tunixODBC: 2.3.7\n\txxhash: 0.8.0\n\nNumber of packages to be installed: 7\n\nThe process will require 409 MiB more space.\n43 MiB to be downloaded.\n\nProceed with this action? &#91;y\/N]: y<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Running MariaDB 10.5 on FreeBSD 12.1<\/h4>\n\n\n\n<p>Once the installation is installed, you can start MariaDB on FreeBSD 12.1;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>service mysql-server onestart<\/code><\/pre>\n\n\n\n<p>Checking the status of MariaDB service on FreeBSD 12.1<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>service mysql-server onestatus<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql is running as pid 1543.<\/code><\/pre>\n\n\n\n<p>You can enable MariaDB to run on system boot using the command below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sysrc mysql_enable=yes<\/code><\/pre>\n\n\n\n<p>Or simply run;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>service mysql-server enable<\/code><\/pre>\n\n\n\n<p id=\"block-c81257d2-a6c6-408e-9a6e-1deb55c9ea11\">You would then be able to manage MariaDB service as follows;<\/p>\n\n\n\n<p>To start MariaDB service;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>service mysql-server start<\/code><\/pre>\n\n\n\n<p>To stop the service;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>service mysql-server stop<\/code><\/pre>\n\n\n\n<p>Disable the service from running on system boot;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>service mysql-server disable<\/code><\/pre>\n\n\n\n<p>Restart MariaDB 10.5 on FreeBSD 12.1<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>service mysql-server restart<\/code><\/pre>\n\n\n\n<p>Check Status;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>service mysql-server status<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Securing MariaDB 10.5 on FreeBSD 12.1<\/h3>\n\n\n\n<p>MariaDB comes with a default security script,&nbsp;<strong><code>mysql_secure_installation&nbsp;<\/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 (if need be).<\/li>\n\n\n\n<li>Disabling remote root login to the databases.<\/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.5 Authentication<\/h3>\n\n\n\n<p>The new installations of MariaDB have two secure accounts are created during the installation. The accounts are&nbsp;<strong><code>root@localhost<\/code><\/strong>&nbsp;and&nbsp;<code><strong>mysql@localhost<\/strong><\/code>. Both accounts uses either of the&nbsp;<strong><code>unix_socket<\/code><\/strong>&nbsp;and the&nbsp;<strong><code>mysql_native_password<\/code><\/strong>&nbsp;authentication plugins.<\/p>\n\n\n\n<p><code><strong>unix_socket<\/strong><\/code>&nbsp;authentication plugin allows a system&nbsp;<code>root<\/code>&nbsp;user or a&nbsp;<code><strong>user with sudo rights<\/strong><\/code>&nbsp;to login as&nbsp;<code><strong>root@locahost<\/strong><\/code>&nbsp;to MariaDB database without a password. You can even login as mysql user.<\/p>\n\n\n\n<p>With&nbsp;<code><strong>unix_socket<\/strong><\/code>&nbsp;authentication plugin, while being a root user, you can simply login by running either of the commands below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>mysql<\/code><\/pre>\n\n\n\n<p>or<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>mysql -u root<\/code><\/pre>\n\n\n\n<p>Even if you run,&nbsp;<code><strong>mysql -u root -p<\/strong><\/code>, and press ENTER for blank password, you will still login.<\/p>\n\n\n\n<p>As a user with sudo rights, prefix the commands above with&nbsp;<code><strong>sudo<\/strong><\/code>.<\/p>\n\n\n\n<p>Read more about MariaDB authentication plugins on <a href=\"https:\/\/mariadb.com\/kb\/en\/authentication-plugins\/\" target=\"_blank\" aria-label=\"MariaDB Knowledge base (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"rank-math-link\">MariaDB Knowledge base<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"enable-mariadb-native-password-authentication\"><a href=\"#enable mariadb-native-password-authentication\" class=\"rank-math-link\">Enable MariaDB password Authentication on FreeBSD 12.1<\/a><\/h3>\n\n\n\n<p>The&nbsp;<code>mysql_native_password<\/code>&nbsp;plugin is used as a failover for the&nbsp;<code>unix_socket<\/code>&nbsp;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<pre class=\"wp-block-preformatted\"><code>flush privileges;\nquit<\/code><\/pre>\n\n\n\n<p>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<pre class=\"wp-block-preformatted\"><code>mysql -u root -p\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Welcome to the MariaDB monitor.  Commands end with ; or \\g.\nYour MariaDB connection id is 15\nServer version: 10.5.5-MariaDB FreeBSD Ports\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\nroot@localhost &#91;(none)]&gt;<\/code><\/pre>\n\n\n\n<p>Similarly, you can login as mysql user;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo -u mysql mysql<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Set Native Password Authentication Method as Default<\/h4>\n\n\n\n<p>To completely disable&nbsp;<code>unix_socke<\/code>t authentication plugin and instead use the&nbsp;<code>msqyl_native_password<\/code>&nbsp;authentication method, simply login to MariaDB and change the authentication plugin for&nbsp;<strong>root<\/strong>&nbsp;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<pre class=\"wp-block-preformatted\"><code>flush privileges;\nquit<\/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-code\"><code>ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)<\/code><\/pre>\n\n\n\n<p>You can go ahead and perform your database tasks using MariaDB 10.5 on FreeBSD 12.1<\/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\" 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\" 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\" 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&nbsp;<\/a><a href=\"https:\/\/kifarunix.com\/install-mariadb-10-3-on-fedora-30\/\" target=\"_blank\" rel=\"noreferrer noopener\">Fedora<\/a><a href=\"https:\/\/kifarunix.com\/install-mariadb-10-3-on-fedora-30\/\">&nbsp;30<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-mysql-8-on-centos-8\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install MySQL 8 on CentOS 8<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" class=\"rank-math-link\" 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>In this tutorial, you will how to install MariaDB 10.5 on FreeBSD 12.1. \u201cMariaDB 10.5&nbsp;is the current&nbsp;stable&nbsp;series of MariaDB. It is an evolution of&nbsp;MariaDB 10.4&nbsp;with<\/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],"tags":[],"class_list":["post-7152","post","type-post","status-publish","format-standard","hentry","category-howtos","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/7152"}],"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=7152"}],"version-history":[{"count":5,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/7152\/revisions"}],"predecessor-version":[{"id":21532,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/7152\/revisions\/21532"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=7152"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=7152"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=7152"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}