{"id":3665,"date":"2020-02-23T22:27:43","date_gmt":"2020-02-23T22:27:43","guid":{"rendered":"https:\/\/lamp.ciscoar.com\/?page_id=3665"},"modified":"2020-02-24T00:10:05","modified_gmt":"2020-02-24T00:10:05","slug":"mariadb-global-settings","status":"publish","type":"page","link":"https:\/\/lamp.ciscoar.com\/?page_id=3665","title":{"rendered":"MariaDB global settings"},"content":{"rendered":"\n\n\n<h2 class=\"wp-block-heading\">MariaDB main config file<\/h2>\n\n\n\n<p>It is quite common on Linux systems to come across with simple text files acting as global settings for different tools, that is also the case of MariaDB, and as you can imagine the name of the file and also the location still the same as in MySQL.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">my.cnf<\/h2>\n\n\n\n<p>Same as in MySQL the MariaDB main config file is called &#8220;my.cnf&#8221; and is located inside the &#8220;\/etc&#8221; folder.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/MariaDB-my.cnf-global-settings.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"763\" height=\"430\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/MariaDB-my.cnf-global-settings.jpg\" alt=\"\" class=\"wp-image-3675\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/MariaDB-my.cnf-global-settings.jpg 763w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/MariaDB-my.cnf-global-settings-300x169.jpg 300w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/a><figcaption>MariaDB main configuration file &#8211; my.cnf<\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">How to open my.cnf with WinSCP<\/h2>\n\n\n\n<p>As you can see in the below animation you can take advantage of the <a href=\"\/winscp-bookmarks\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"WinSCP bookmarks (opens in a new tab)\">WinSCP bookmarks<\/a> to go directly to the folder where you can open the file by just double clicking.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"504\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-mariadb-my.cnf-global-settings.gif\" alt=\"\" class=\"wp-image-3669\"\/><figcaption>MariaDB my.cnf<\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">How to open my.cnf with vi<\/h2>\n\n\n\n<p>Those of you who prefer the terminal can use the following CLI command to open the file &#8220;my.cnf&#8221; with &#8220;vi&#8221;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"vim\" class=\"language-vim\">vi \/etc\/my.cnf<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">MariaDB default settings<\/h2>\n\n\n\n<p>Here you can see the default settings found on a fresh MariaDB installation, from now on it&#8217;s quite probably that this file start growing depending on the modifications you may want to made, just as an example, if you want to enable the &#8220;<strong>binary log<\/strong>&#8221; this is the file where that change is made (below the mysqld section).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"rest\" class=\"language-rest\">[mysqld]\ndatadir=\/var\/lib\/mysql\nsocket=\/var\/lib\/mysql\/mysql.sock\n# Disabling symbolic-links is recommended to prevent assorted security risks\nsymbolic-links=0\n# Settings user and group are ignored when systemd is used.\n# If you need to run mysqld under a different user or group,\n# customize your systemd unit file for mariadb according to the\n# instructions in http:\/\/fedoraproject.org\/wiki\/Systemd\n\n[mysqld_safe]\nlog-error=\/var\/log\/mariadb\/mariadb.log\npid-file=\/var\/run\/mariadb\/mariadb.pid\n\n#\n# include all files from the config directory\n#\n!includedir \/etc\/my.cnf.d<\/code><\/pre>\n\n\n\n<p>If you decide to move the database to a different folder you must modify this file accordingly as well as SELinux security policy and also the security context of the new directory.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">my.cnf.d (the include) directory<\/h2>\n\n\n\n<p>MariaDB has an specific directory intended for keeping all the configuration files, by the default you are going to find the following three files.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/mariadb-my.cnf_.d-folder.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"634\" height=\"214\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/mariadb-my.cnf_.d-folder.jpg\" alt=\"\" class=\"wp-image-3711\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/mariadb-my.cnf_.d-folder.jpg 634w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/mariadb-my.cnf_.d-folder-300x101.jpg 300w\" sizes=\"auto, (max-width: 634px) 100vw, 634px\" \/><\/a><figcaption>MariaDB configuration files<\/figcaption><\/figure><\/div>\n\n\n\n<p>You can add more configuration files inside this folder, just be sure to end their names with the &#8220;.cnf&#8221; extension in order for them to be processed as such.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/mariadb-my.cnf_.d-folder-02.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"176\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/mariadb-my.cnf_.d-folder-02.jpg\" alt=\"\" class=\"wp-image-3712\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/mariadb-my.cnf_.d-folder-02.jpg 600w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/mariadb-my.cnf_.d-folder-02-300x88.jpg 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><figcaption>.cnf extension is mandatory<\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Error log file<\/h2>\n\n\n\n<p>Below the [mysqld_safe] section you can see the name and location of the <strong>error log file<\/strong> &#8220;mariadb.log&#8221;, you can use &#8220;cat&#8221; and &#8220;grep&#8221; as follow to see only this particular line.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"vim\" class=\"language-vim\">cat \/etc\/my.cnf | grep log <\/code><\/pre>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/mariadb-error-log-file-mariadb.log_.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"465\" height=\"167\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/mariadb-error-log-file-mariadb.log_.jpg\" alt=\"\" class=\"wp-image-3700\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/mariadb-error-log-file-mariadb.log_.jpg 465w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/mariadb-error-log-file-mariadb.log_-300x108.jpg 300w\" sizes=\"auto, (max-width: 465px) 100vw, 465px\" \/><\/a><figcaption>MariaDB error log file &#8220;mariadb.log&#8221;<\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Binary Logs<\/h2>\n\n\n\n<p>Binary Logs are disabled by default, you may want to enable them when doing troubleshooting as this brings to light a bunch of useful information, in our case the binary log is still disable as you can see in the following image.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-mariadb-show-binary-logs.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"501\" height=\"80\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-mariadb-show-binary-logs.jpg\" alt=\"\" class=\"wp-image-3691\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-mariadb-show-binary-logs.jpg 501w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/02\/linux-centos7-mariadb-show-binary-logs-300x48.jpg 300w\" sizes=\"auto, (max-width: 501px) 100vw, 501px\" \/><\/a><figcaption>mariadb show binary logs<\/figcaption><\/figure><\/div>\n\n\n\n<p>We are going to cover the &#8220;binary logs&#8221; in further articles when troubleshooting MariaDB.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MariaDB main config file It is quite common on Linux systems to come across with simple text files acting as global settings for different tools, that is also the case of MariaDB, and as you can imagine the name of the file and also the location still the same as in MySQL. my.cnf Same as &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/lamp.ciscoar.com\/?page_id=3665\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;MariaDB global settings&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-3665","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/pages\/3665","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3665"}],"version-history":[{"count":24,"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/pages\/3665\/revisions"}],"predecessor-version":[{"id":3717,"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/pages\/3665\/revisions\/3717"}],"wp:attachment":[{"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3665"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}