{"id":79094,"date":"2026-11-17T02:00:27","date_gmt":"2026-11-17T02:00:27","guid":{"rendered":"http:\/\/bangla.sitestree.com\/?p=79094"},"modified":"2026-11-17T02:00:27","modified_gmt":"2026-11-17T02:00:27","slug":"linux-advanced-09-mariadb","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=79094","title":{"rendered":"Linux Advanced 09 \u2014 MariaDB Service Accounts and Restore Verification"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/bangla.sitestree.com\/?name=linux-course-index\">Linux course index<\/a> \u00b7 <a href=\"https:\/\/bangla.sitestree.com\/?cat=1992\">Linux Advanced category<\/a> \u00b7 Lesson 9 of 9<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>AI disclosure<\/strong> \u2014 AI-generated content, posted as is. AI can make mistakes. This lesson draws on the linked Open Education posts and adds original explanations or lab examples where useful. The newly written explanations and examples may be freely reused. Linked source material retains its own terms.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Learning goal<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Check a Linux-hosted MariaDB service, identify least-privilege database roles, and test a logical restore.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Concepts and setup<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The archive\u2019s RHCE notes cover MariaDB packages, service operation, configuration, accounts, and backup. The server is a daemon, while the client sends it queries. Distribution packages vary in service names and default authentication. Use only necessary packages and keep the database off untrusted networks.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use a disposable VM and its authorized local administration account. Real applications should use dedicated accounts with only required privileges. This fixture uses two unused schemas and InnoDB. It is not a full server backup.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Check the service and create a test database<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl is-active mariadb\nsudo mariadb &lt;&lt;'SQL'\nCREATE DATABASE oe_linux_demo;\nCREATE TABLE oe_linux_demo.checks (\n  id INT PRIMARY KEY,\n  status VARCHAR(15) NOT NULL\n) ENGINE=InnoDB;\nINSERT INTO oe_linux_demo.checks VALUES (1,'ready'),(2,'verified');\nSELECT id, status FROM oe_linux_demo.checks ORDER BY id;\nSQL<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Possible output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>active\nid  status\n1   ready\n2   verified<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the distribution does not enable socket authentication for sudo mariadb, use the lab&#8217;s authorized local authentication path. Do not put credentials into command history or lab reports.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Define a read-only role without creating a login<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mariadb &lt;&lt;'SQL'\nCREATE ROLE oe_linux_reader;\nGRANT SELECT ON oe_linux_demo.checks TO oe_linux_reader;\nSHOW GRANTS FOR oe_linux_reader;\nSQL<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Possible output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Grants for oe_linux_reader\nGRANT USAGE ON *.* TO `oe_linux_reader`\nGRANT SELECT ON `oe_linux_demo`.`checks` TO `oe_linux_reader`<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The exact display varies. The role defines scoped read access but is not itself the application\u2019s login. In a real deployment, configure an approved application account, grant the role, and verify both an allowed SELECT and a denied write from that account. Remove the lab role when retiring the two fixture schemas.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Export locally and verify a separate restore<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>lab=$(mktemp -d)\n( umask 077; sudo mariadb-dump --single-transaction oe_linux_demo &gt; &quot;$lab\/demo.sql&quot; )\nsudo mariadb -e 'CREATE DATABASE oe_linux_restore;'\nsudo mariadb oe_linux_restore &lt; &quot;$lab\/demo.sql&quot;\nsudo mariadb -N -e 'SELECT id,status FROM oe_linux_restore.checks ORDER BY id;'\nsudo mariadb -N -e 'SELECT COUNT(*) FROM oe_linux_restore.checks;'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Possible output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>1  ready\n2  verified\n2<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Stop at any error. The transaction helps for InnoDB data, not all engines and object types. Avoid concurrent schema changes. After verification, retire only your fixture schemas and securely handle the dump.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Questions only<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Quick-check questions<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li>Why restore into a different schema?<\/li>\n\n\n<li>Can a running service prove the dump is valid?<\/li>\n\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Assessment questions<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li>Name two checks that provide evidence of recovery beyond a dump file\u2019s size.<\/li>\n\n\n<li>What rights would you give a reporting application account?<\/li>\n\n\n<li>Why can &#8211;single-transaction be insufficient for a mixed-engine database?<\/li>\n\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Questions and answers<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Quick-check answers<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li><strong>Why restore into a different schema?<\/strong><br><strong>Answer<\/strong> \u2014 It avoids modifying the original and gives a separate verification target.<\/li>\n\n\n<li><strong>Can a running service prove the dump is valid?<\/strong><br><strong>Answer<\/strong> \u2014 No. Test an actual restore and query it.<\/li>\n\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Assessment answer key<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li><strong>Name two checks that provide evidence of recovery beyond a dump file\u2019s size.<\/strong><br><strong>Answer<\/strong> \u2014 Compare expected row counts and known rows or checksums, then test representative application queries.<\/li>\n\n\n<li><strong>What rights would you give a reporting application account?<\/strong><br><strong>Answer<\/strong> \u2014 Only the required SELECT rights on specified tables or schemas, with appropriate account location and authentication restrictions.<\/li>\n\n\n<li><strong>Why can &#8211;single-transaction be insufficient for a mixed-engine database?<\/strong><br><strong>Answer<\/strong> \u2014 Nontransactional engines do not share the same consistent transaction snapshot. Concurrent changes to schema definitions can also invalidate assumptions.<\/li>\n\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Source articles on this site<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=67600\">Learn some Centos\/Redhat Linux: RHCE: MariaDB Administration on Redhat\/Fedora\/CentOS #DevOps #RHCE<\/a><\/li>\n\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=20411\">Learn some Centos\/Redhat Linux: RHCE: MariaDB Administration on Redhat\/Fedora\/CentOS<\/a><\/li>\n\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=78097\">How to install phpMyAdmin on Linux (AlmaLinux )<\/a><\/li>\n\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=21831\">Some Ubuntu Linux Commands used in AWS platform #Unix\/Linux #RHCSA<\/a><\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Continue the course<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Previous lesson 08 \u2014 Apache Virtual Hosts and HTTPS. This is the last lesson in this level. See the course index for the next level.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/bangla.sitestree.com\/?name=linux-course-index\">Linux course index<\/a> \u00b7 <a href=\"https:\/\/bangla.sitestree.com\/?cat=1992\">Linux Advanced category<\/a> \u00b7 Lesson 9 of 9<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Check a Linux-hosted MariaDB service, identify least-privilege database roles, and test a logical restore.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[1992],"tags":[],"class_list":["post-79094","post","type-post","status-publish","format-standard","hentry","category-linux-advanced","item-wrap"],"jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":79102,"url":"http:\/\/bangla.sitestree.com\/?p=79102","url_meta":{"origin":79094,"position":0},"title":"Linux Administration Course \u2014 Start Here and Lesson Index","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"A 33-lesson Linux course from shell fundamentals to server administration, performance, and a recovery capstone.","rel":"","context":"In &quot;Linux Basics&quot;","block_context":{"text":"Linux Basics","link":"http:\/\/bangla.sitestree.com\/?cat=1990"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79100,"url":"http:\/\/bangla.sitestree.com\/?p=79100","url_meta":{"origin":79094,"position":1},"title":"Linux Advanced 2 06 \u2014 Encrypted Backups and Restore Drills","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Create an encrypted Restic snapshot and verify a real restore into a separate directory.","rel":"","context":"In &quot;Linux Advanced 2&quot;","block_context":{"text":"Linux Advanced 2","link":"http:\/\/bangla.sitestree.com\/?cat=1993"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":20401,"url":"http:\/\/bangla.sitestree.com\/?p=20401","url_meta":{"origin":79094,"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":"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":79094,"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":20405,"url":"http:\/\/bangla.sitestree.com\/?p=20405","url_meta":{"origin":79094,"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":20409,"url":"http:\/\/bangla.sitestree.com\/?p=20409","url_meta":{"origin":79094,"position":5},"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":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/79094","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\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=79094"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/79094\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=79094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=79094"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=79094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}