{"id":1280,"date":"2023-09-04T12:00:00","date_gmt":"2023-09-04T19:00:00","guid":{"rendered":"https:\/\/letsbuildroboticswithshadow8472.com\/?p=1280"},"modified":"2023-09-11T02:16:54","modified_gmt":"2023-09-11T09:16:54","slug":"my-nextcloud-sees-its-database-but","status":"publish","type":"post","link":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/2023\/09\/04\/my-nextcloud-sees-its-database-but\/","title":{"rendered":"My Nextcloud Sees its Database, but&#8230;"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Good Morning from my Robotics Lab! This is Shadow_8472, and today is another Nextcloud shot. Let\u2019s get started!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It almost needs not an introduction at this point. I\u2019ve lost track of how long I\u2019ve been after a Nextcloud instance \u2013 and even the number of times I\u2019ve complained about the same. I\u2019ve demoed it using an integrated database, and I\u2019ve since gotten its container into a Podman pod. My task today is getting the paired MariaDB container to behave.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s start with my first error. Nextcloud is starting for the first time and it\u2019s time to make an admin account.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The container has been launched with flags providing environment variables pointing Nextcloud at the database and specifying the username\/password to get in. I found someone having the exact same problem 4 years ago on Stack Overflow, and if I get user2880156\u2019s explanation, \u201clocalhost\u201d is not the same as spelling out a loopback IP address, like 127.0.0.1 [1]. While some networked applications don\u2019t care how they interact as server and client when on the same computer [namespace?], Nextcloud and MariaDB are not such a pair. It has something to do with types of network sockets, but I don\u2019t understand beyond that. What matters to me now is that replacing \u201clocalhost\u201d with \u201c127.0.0.1\u201d got me to my next error.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">MySQL username and\/or password not valid You need to enter details of an existing account.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I\u2019ve checked my environment variables more times than I can count. The required usernames and passwords were copy-pasted between the respective environment variables. The best lead I have is that the container may be bugged. People online have reported success with manually creating the full permissions\/non-root account the database container is supposed to create on initial creation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This insight led me to seek a manual fix from within the pod \u2013 specifically from a MariaDB command line as mentioned in the container\u2019s documentation. After trying several different ways to modify a terminal command to run with Cockpit, I gave up, re-added a couple flags I was avoiding, and got the interface I was after rendered to both bash and Cockpit. I additionally split the command back into a separate script.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The MariaDB command line is unlike any I\u2019ve used before. My first impressions are that commands are in all caps and variables are lower case. My final achievement before running out of time was to extract a list of user names (root, healthCheck, and databaseUser), where they\u2019ve logged in from (variations on locations within the pod), and a partial hexadecimal output of their passwords.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Takeaway<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Solving localhost vs 127.0.0.1 addresses has given me insight into Cockpit\u2019s curious behavior when remoting into to itself with localhost. Command line access to the database from within the pod is also huge.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Final Question<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">I\u2019m not taking bets, and I\u2019m afraid to ask, but what additional roadblocks should I expect?<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Work Cited<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">[1] akrea, et. all, \u201cnextcloud and mariadb (both) on docker: SQLSTATE[HY000] [2002] No such file or directory,\u201d<em> stackoverflow.com<\/em> Mar. 10, 2019-Mar. 22, 2023. [Online]. Available:<a href=\"https:\/\/stackoverflow.com\/questions\/55088828\/nextcloud-and-mariadb-both-on-docker-sqlstatehy000-2002-no-such-file-or-d\">https:\/\/stackoverflow.com\/questions\/55088828\/nextcloud-and-mariadb-both-on-docker-sqlstatehy000-2002-no-such-file-or-d<\/a>. [Accessed Sept. 4, 2023].<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Good Morning from my Robotics Lab! This is Shadow_8472, and today is another Nextcloud shot. Let\u2019s get started! It almost needs not an introduction at this point. I\u2019ve lost track of how long I\u2019ve been after a Nextcloud instance \u2013 and even the number of times I\u2019ve complained about the same. I\u2019ve demoed it using &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/2023\/09\/04\/my-nextcloud-sees-its-database-but\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;My Nextcloud Sees its Database, but&#8230;&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[14,195],"tags":[275,276,277,278,211],"class_list":["post-1280","post","type-post","status-publish","format-standard","hentry","category-networking","category-server","tag-incomplete-project","tag-localhost-vs-127-0-0-1","tag-mariadb","tag-mysql","tag-nextcloud"],"_links":{"self":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts\/1280","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/comments?post=1280"}],"version-history":[{"count":1,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts\/1280\/revisions"}],"predecessor-version":[{"id":1281,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts\/1280\/revisions\/1281"}],"wp:attachment":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/media?parent=1280"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/categories?post=1280"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/tags?post=1280"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}