{"id":1620,"date":"2018-02-02T13:15:00","date_gmt":"2018-02-02T20:15:00","guid":{"rendered":"http:\/\/jim-zimmerman.com\/?p=1620"},"modified":"2018-02-02T13:15:00","modified_gmt":"2018-02-02T20:15:00","slug":"mysql-db-access-via-shell","status":"publish","type":"post","link":"https:\/\/jim-zimmerman.com\/?p=1620","title":{"rendered":"MySQL DB access via shell."},"content":{"rendered":"<p>Here is a decent secure way to get yourself access to your MySQL\/MariaDB databases from a shell script in linux:<\/p>\n<p># umask 277<br \/>\n# vi \/somedirectory\/.supersecretfile<br \/>\n# ls -l \/somedirectory\/.supersecretfile<br \/>\n-r&#8212;&#8212;&#8211;. 1 root root 36 Feb  2 11:58 \/somedirectory\/.supersecretfile<br \/>\n# umask 022<\/p>\n<p># mysql &#8211;defaults-file=\/somedirectory\/.supersecretfile -e &#8220;SOME SQL COMMAND&#8221;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here is a decent secure way to get yourself access to your MySQL\/MariaDB databases from a shell script in linux: # umask 277 # vi \/somedirectory\/.supersecretfile # ls -l \/somedirectory\/.supersecretfile -r&#8212;&#8212;&#8211;. 1 root root 36 Feb 2 11:58 \/somedirectory\/.supersecretfile # umask 022 # mysql &#8211;defaults-file=\/somedirectory\/.supersecretfile -e &#8220;SOME SQL COMMAND&#038;#<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[48,248],"class_list":["post-1620","post","type-post","status-publish","format-standard","hentry","category-documentation","tag-linux","tag-mysql"],"share_on_mastodon":{"url":"","error":""},"_links":{"self":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1620","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1620"}],"version-history":[{"count":1,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1620\/revisions"}],"predecessor-version":[{"id":1621,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1620\/revisions\/1621"}],"wp:attachment":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1620"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1620"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1620"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}