{"id":67600,"date":"2021-07-25T21:30:09","date_gmt":"2021-07-26T01:30:09","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/learn-some-centos-redhat-linux-rhce-mariadb-administration-on-redhat-fedora-centos-devops-rhce\/"},"modified":"2021-07-25T21:30:09","modified_gmt":"2021-07-26T01:30:09","slug":"learn-some-centos-redhat-linux-rhce-mariadb-administration-on-redhat-fedora-centos-devops-rhce","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=67600","title":{"rendered":"Learn some Centos\/Redhat Linux: RHCE: MariaDB Administration on Redhat\/Fedora\/CentOS #DevOps #RHCE"},"content":{"rendered":"<p><strong>RHCE: MariaDB Administration on Redhat\/Fedora\/CentOS<\/strong><\/p>\n<p><strong>Check if mariaDB is installed or not<\/strong><\/p>\n<p>130 yum list installed | grep ^mariadb<\/p>\n<p>mariaDB originated from MySQL &#8211; after MySQL Got Bought by Oracle<\/p>\n<p>133 yum list installed | grep ^mariadb<\/p>\n<p>I see &#8211; installed though not completely<\/p>\n<p><strong>Output:<\/strong><\/p>\n<p>mariadb-libs.x86_64 1:5.5.52-1.el7 @anaconda<\/p>\n<p>There are two other components: mariaDB &#8211; client component. MariaDB-server: Server Component<\/p>\n<p><strong>The MariaDB packages:<\/strong><br \/>\n138 mariadb-bench.x86_64 mariadb-devel.x86_64 mariadb-server.x86_64 mariadb-test.x86_64 mariadb.x86_64<\/p>\n<p><strong>Install all packages at once<\/strong><\/p>\n<p>139 yum install mariadb*<br \/>\n140 yum list installed | grep ^mariadb<\/p>\n<p>Now, I see the following, after I have installed &#8211; all MariaDB packages available in my system<br \/>\nmariadb.x86_64 1:5.5.52-1.el7 @local<br \/>\nmariadb-bench.x86_64 1:5.5.52-1.el7 @local<br \/>\nmariadb-devel.x86_64 1:5.5.52-1.el7 @local<br \/>\nmariadb-libs.x86_64 1:5.5.52-1.el7 @anaconda<br \/>\nmariadb-server.x86_64 1:5.5.52-1.el7 @local<br \/>\nmariadb-test.x86_64 1:5.5.52-1.el7 @local<\/p>\n<p><strong>MariaDB Configuration Files<\/strong><br \/>\n149 ls \/etc\/my.cnf<br \/>\n150 ls \/etc\/my.cnf.d\/*<\/p>\n<p>The files<br \/>\n\/etc\/my.cnf.d\/client.cnf \/etc\/my.cnf.d\/mysql-clients.cnf \/etc\/my.cnf.d\/server.cnf<\/p>\n<p>153 vim \/etc\/my.cnf<br \/>\n154 vim \/etc\/my.cnf.d\/client.cnf<br \/>\n155 vim \/etc\/my.cnf.d\/server.cnf<br \/>\n156 vim \/etc\/my.cnf.d\/mysql-clients.cnf<br \/>\n157 main config file \/etc\/my.cnf<\/p>\n<p>158 grep -v ^# \/etc\/my.cnf : will show lines that are not comments<br \/>\n159 grep -v ^# \/etc\/my.cnf<\/p>\n<p><strong>The content of my.cnf : some lines are self explanatory<\/strong><\/p>\n<p>[mysqld]<br \/>\ndatadir=\/var\/lib\/mysql<br \/>\nsocket=\/var\/lib\/mysql\/mysql.sock<br \/>\nsymbolic-links=0<br \/>\n[mysqld_safe]<br \/>\nlog-error=\/var\/log\/mariadb\/mariadb.log<br \/>\npid-file=\/var\/run\/mariadb\/mariadb.pid<\/p>\n<p>MariaDB messages are logged at: \/var\/log\/mariadb\/mariadb.log<\/p>\n<p><strong>MySQL Specific Selinux Contexts<\/strong><br \/>\n171 ps -eZ | grep mysqld<br \/>\nI do not see anything as mysqld\/maridb is not running<\/p>\n<p>178 systemctl start mariadb.service<br \/>\n179 systemctl enable mariadb.service<br \/>\n180 ps -eZ | grep mysqld<\/p>\n<p>now the output:<br \/>\nsystem_u:system_r:mysqld_safe_t:s0 4428 ? 00:00:00 mysqld_safe<br \/>\nsystem_u:system_r:mysqld_t:s0 4585 ? 00:00:00 mysqld<\/p>\n<p>184 mysqld runs on it&#8217;s own domain mysqld_t<\/p>\n<p><strong>Related Selinux file type: mysql_exec_t<\/strong><br \/>\netc_t is for \/etc\/my.cnf.d<br \/>\nmysql_db_t is for \/var\/lib\/mysql\/<br \/>\nmysql_log_t is for \/var\/log\/mariadb\/<br \/>\n189 ll -dZ \/usr\/libexec\/mysqld \/etc\/my.cnf.d \/var\/lib\/mysql \/var\/log\/mariadb<\/p>\n<p><strong>The output &#8211; please note the Selinux Contexts in the output<\/strong><br \/>\ndrwxr-xr-x. root root system_u:object_r:mysqld_etc_t:s0 \/etc\/my.cnf.d<br \/>\n-rwxr-xr-x. root root system_u:object_r:mysqld_exec_t:s0 \/usr\/libexec\/mysqld<br \/>\ndrwxr-xr-x. mysql mysql system_u:object_r:mysqld_db_t:s0 \/var\/lib\/mysql<br \/>\ndrwxr-x&#8212;. mysql mysql system_u:object_r:mysqld_log_t:s0 \/var\/log\/mariadb<\/p>\n<p><strong>Corresponding Selinux Port Type: mysql_port_t<\/strong><br \/>\n196 semanage port -l | grep mysqld<br \/>\noutput:<br \/>\nmysqld_port_t tcp 1186, 3306, 63132-63164<\/p>\n<p>Related Selinux Booleans: mysql_connect_any, selinuxuser_mysql_connect_enabled<br \/>\n200 getsebool -a | grep mysql<\/p>\n<p>I see the output<br \/>\nmysql_connect_any &#8211;&gt; off<br \/>\nselinuxuser_mysql_connect_enabled &#8211;&gt; off<\/p>\n<p><strong>To install MariaDB-Server:<\/strong><br \/>\n205 yum -y install mariadb-server<br \/>\nalready installed. we installed with yum -y install mariadb* [installed everything together]<\/p>\n<p>207 systemctl enable mariadb<\/p>\n<p><strong>We can run mysql_secure_installation &#8211; to secure our MariaDB installation<\/strong><br \/>\n209 mysql_secure_installation<\/p>\n<p>&#8212;&#8211;<\/p>\n<p>The Output: from mysql_secure_installation command<br \/>\nNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB<br \/>\nSERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!<br \/>\nIn order to log into MariaDB to secure it, we&#8217;ll need the current<br \/>\npassword for the root user. If you&#8217;ve just installed MariaDB, and<br \/>\nyou haven&#8217;t set the root password yet, the password will be blank,<br \/>\nso you should just press enter here.<\/p>\n<p>Enter current password for root (enter for none):<br \/>\nOK, successfully used password, moving on&#8230;<\/p>\n<p>Setting the root password ensures that nobody can log into the MariaDB<br \/>\nroot user without the proper authorisation.<\/p>\n<p>Set root password? [Y\/n] y<br \/>\nNew password:<br \/>\nRe-enter new password:<br \/>\nPassword updated successfully!<br \/>\nReloading privilege tables..<br \/>\n&#8230; Success!<\/p>\n<p>By default, a MariaDB installation has an anonymous user, allowing anyone<br \/>\nto log into MariaDB without having to have a user account created for<br \/>\nthem. This is intended only for testing, and to make the installation<br \/>\ngo a bit smoother. You should remove them before moving into a<br \/>\nproduction environment.<\/p>\n<p>Remove anonymous users? [Y\/n] y<br \/>\n&#8230; Success!<\/p>\n<p>Normally, root should only be allowed to connect from &#8216;localhost&#8217;. This<br \/>\nensures that someone cannot guess at the root password from the network.<\/p>\n<p>Disallow root login remotely? [Y\/n] y<br \/>\n&#8230; Success!<\/p>\n<p>By default, MariaDB comes with a database named &#8216;test&#8217; that anyone can<br \/>\naccess. This is also intended only for testing, and should be removed<br \/>\nbefore moving into a production environment.<\/p>\n<p>Remove test database and access to it? [Y\/n] y<br \/>\n&#8211; Dropping test database&#8230;<br \/>\n&#8230; Success!<br \/>\n&#8211; Removing privileges on test database&#8230;<br \/>\n&#8230; Success!<\/p>\n<p>Reloading the privilege tables will ensure that all changes made so far<br \/>\nwill take effect immediately.<\/p>\n<p>Reload privilege tables now? [Y\/n] y<br \/>\n&#8230; Success!<\/p>\n<p>Cleaning up&#8230;<\/p>\n<p>All done! If you&#8217;ve completed all of the above steps, your MariaDB<\/p>\n<hr \/>\n<p>installation should now be secure.<br \/>\nThanks for using MariaDB!<\/p>\n<p>Enable MariaDB through Firewall and Allow traffic on Port 3306 &#8211; default mysql port<br \/>\n218 firewall-cmd &#8211;add-service=mysql &#8211;perm<br \/>\n220 firewall-cmd &#8211;reload<\/p>\n<p>221 systemctl start mariadb<br \/>\n222 systemctl status mariadb<br \/>\n223 start mysql\/mariadb<\/p>\n<p><strong>Run MySQL<\/strong><\/p>\n<p>224 mysql -u root -p<\/p>\n<p>mysqldump is used to backup a database<br \/>\nmysql command can be used to restore a database<br \/>\nyou can even use IDEs such as MySQL Workbench to backup and restore MySQL Databases<\/p>\n<p>228 mysql -u root -p<br \/>\n229 mysqldump -u root -p testsayed &gt; testsayeddb.sql<\/p>\n<p>to restore &#8211; you need to use &lt; testsayeddb.sql<br \/>\n231 mysql -u root -p testsayed &lt; testsayeddb.sql<\/p>\n<p><strong>Backup and Restore MySQL Database<\/strong><\/p>\n<p>You can backup multiple databases at once, you can even backup some tables or other database objects using mysqldump<\/p>\n<p>similarly, you can restore multiple databases at the same time using mysql command<br \/>\njust use multiple datbase or database object names with NO comma &#8211; one after another<\/p>\n<p>235 mysqldump -u root -p DB1 DB2 DB3 &gt; alldb.sql<\/p>\n<p>when you use restore and give the sql file &#8211; if you use db name or table name before &lt; then only that part will be restored irrespective hiow much data is there on the file<\/p>\n<p><strong>example<\/strong><br \/>\n238 mysql -u root -p DB1 tbl1 &lt; alldb.sql ;<\/p>\n<p>you can use &#8211;all-databases or &#8211;databases with mysqldump command From: http:\/\/sitestree.com\/?p=12128<br \/> Categories:DevOps, RHCE<br \/>Tags:<br \/> Post Data:2018-01-03 18:59:06<\/p>\n<p>\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com\/' target='new' rel=\"noopener\">https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\t(Big Data, Cloud, Security, Machine Learning): Courses: <a href='http:\/\/Training.SitesTree.com' target='new' rel=\"noopener\"> http:\/\/Training.SitesTree.com<\/a><br \/>\n\t\tIn Bengali: <a href='http:\/\/Bangla.SaLearningSchool.com' target='new' rel=\"noopener\">http:\/\/Bangla.SaLearningSchool.com<\/a><br \/>\n\t\t<a href='http:\/\/SitesTree.com' target='new' rel=\"noopener\">http:\/\/SitesTree.com<\/a><br \/>\n\t\t8112223 Canada Inc.\/JustEtc: <a href='http:\/\/JustEtc.net' target='new' rel=\"noopener\">http:\/\/JustEtc.net (Software\/Web\/Mobile\/Big-Data\/Machine Learning) <\/a><br \/>\n\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com'> https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\tMedium: <a href='https:\/\/medium.com\/@SayedAhmedCanada' target='new' rel=\"noopener\"> https:\/\/medium.com\/@SayedAhmedCanada <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>RHCE: MariaDB Administration on Redhat\/Fedora\/CentOS Check if mariaDB is installed or not 130 yum list installed | grep ^mariadb mariaDB originated from MySQL &#8211; after MySQL Got Bought by Oracle 133 yum list installed | grep ^mariadb I see &#8211; installed though not completely Output: mariadb-libs.x86_64 1:5.5.52-1.el7 @anaconda There are two other components: mariaDB &#8211; &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=67600\">Continue reading<\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1917],"tags":[],"class_list":["post-67600","post","type-post","status-publish","format-standard","hentry","category-fromsitestree-com","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":20401,"url":"http:\/\/bangla.sitestree.com\/?p=20401","url_meta":{"origin":67600,"position":0},"title":"Learn some Centos\/Redhat Linux: RHCE: MariaDB Administration on Redhat\/Fedora\/CentOS","author":"Author-Check- Article-or-Video","date":"February 20, 2021","format":false,"excerpt":"RHCE: MariaDB Administration on Redhat\/Fedora\/CentOS Check if mariaDB is installed or not 130 yum list installed | grep ^mariadb mariaDB originated from MySQL - after MySQL Got Bought by Oracle 133 yum list installed | grep ^mariadb I see - installed though not completely Output: mariadb-libs.x86_64 1:5.5.52-1.el7 @anaconda There are\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":20403,"url":"http:\/\/bangla.sitestree.com\/?p=20403","url_meta":{"origin":67600,"position":1},"title":"Learn some Centos\/Redhat Linux: RHCE: MariaDB Administration on Redhat\/Fedora\/CentOS","author":"Author-Check- Article-or-Video","date":"February 20, 2021","format":false,"excerpt":"The author is: the_authornRHCE: MariaDB Administration on Redhat\/Fedora\/CentOS Check if mariaDB is installed or not 130 yum list installed | grep ^mariadb mariaDB originated from MySQL - after MySQL Got Bought by Oracle 133 yum list installed | grep ^mariadb I see - installed though not completely Output: mariadb-libs.x86_64 1:5.5.52-1.el7\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":20405,"url":"http:\/\/bangla.sitestree.com\/?p=20405","url_meta":{"origin":67600,"position":2},"title":"Learn some Centos\/Redhat Linux: RHCE: MariaDB Administration on Redhat\/Fedora\/CentOS","author":"Author-Check- Article-or-Video","date":"February 20, 2021","format":false,"excerpt":"The author is: the_authornRHCE: MariaDB Administration on Redhat\/Fedora\/CentOS Check if mariaDB is installed or not 130 yum list installed | grep ^mariadb mariaDB originated from MySQL - after MySQL Got Bought by Oracle 133 yum list installed | grep ^mariadb I see - installed though not completely Output: mariadb-libs.x86_64 1:5.5.52-1.el7\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":20409,"url":"http:\/\/bangla.sitestree.com\/?p=20409","url_meta":{"origin":67600,"position":3},"title":"Learn some Centos\/Redhat Linux: RHCE: MariaDB Administration on Redhat\/Fedora\/CentOS","author":"Author-Check- Article-or-Video","date":"February 20, 2021","format":false,"excerpt":"The author is: the_authornRHCE: MariaDB Administration on Redhat\/Fedora\/CentOS Check if mariaDB is installed or not 130 yum list installed | grep ^mariadb mariaDB originated from MySQL - after MySQL Got Bought by Oracle 133 yum list installed | grep ^mariadb I see - installed though not completely Output: mariadb-libs.x86_64 1:5.5.52-1.el7\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":20411,"url":"http:\/\/bangla.sitestree.com\/?p=20411","url_meta":{"origin":67600,"position":4},"title":"Learn some Centos\/Redhat Linux: RHCE: MariaDB Administration on Redhat\/Fedora\/CentOS","author":"Author-Check- Article-or-Video","date":"February 20, 2021","format":false,"excerpt":"The author is: the_authornRHCE: MariaDB Administration on Redhat\/Fedora\/CentOS Check if mariaDB is installed or not 130 yum list installed | grep ^mariadb mariaDB originated from MySQL - after MySQL Got Bought by Oracle 133 yum list installed | grep ^mariadb I see - installed though not completely Output: mariadb-libs.x86_64 1:5.5.52-1.el7\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":70313,"url":"http:\/\/bangla.sitestree.com\/?p=70313","url_meta":{"origin":67600,"position":5},"title":"Learn some Centos\/Redhat Linux: RHCE: MariaDB Administration on Redhat\/Fedora\/CentOS #nothing","author":"Author-Check- Article-or-Video","date":"September 1, 2021","format":false,"excerpt":"RHCE: MariaDB Administration on Redhat\/Fedora\/CentOS Check if mariaDB is installed or not 130 yum list installed | grep ^mariadb mariaDB originated from MySQL - after MySQL Got Bought by Oracle 133 yum list installed | grep ^mariadb I see - installed though not completely Output: mariadb-libs.x86_64 1:5.5.52-1.el7 @anaconda There are\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/67600","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=67600"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/67600\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=67600"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=67600"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=67600"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}