{"id":2696,"date":"2020-05-01T10:42:25","date_gmt":"2020-05-01T18:42:25","guid":{"rendered":"http:\/\/pididu.com\/wordpress\/?p=2696"},"modified":"2020-05-01T10:42:26","modified_gmt":"2020-05-01T18:42:26","slug":"reset-root-password-for-mariadb","status":"publish","type":"post","link":"http:\/\/pididu.com\/wordpress\/blog\/reset-root-password-for-mariadb\/","title":{"rendered":"Reset root password for mariadb"},"content":{"rendered":"\n<p>Bottom line:<em> It may not be necessary<\/em> to reset the root password for your mariadb.<\/p>\n\n\n\n<p>With a recent compromise of my wordpress server on a Raspberry Pi, I thought it best to change database user passwords as a precaution.  Resetting my own password was simple:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ mariadb -u myself -p\nEnter password: \nWelcome to the MariaDB monitor.  Commands end with ; or \\g.\nYour MariaDB connection id is 6111\nServer version: 10.1.44-MariaDB-0+deb9u1 Raspbian 9.11\n\nCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\n\nMariaDB [(none)]&gt; set password = password('MyNewPassword');\nQuery OK, 0 rows affected (0.01 sec)\n\nMariaDB [(none)]&gt; flush privileges;\nQuery OK, 0 rows affected (0.00 sec)\n\nMariaDB [(none)]&gt; exit;\nBye\n$\n<\/pre>\n\n\n\n<p>But how about the root password?  When I tried something similar,<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">MariaDB [(none)]> set password for 'root'@'localhost' = password('NewRootPassword');\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\nMariaDB [(none)]> show warnings;\n+-------+------+-----------------------------------------------------------------------+\n| Level | Code | Message |\n+-------+------+-----------------------------------------------------------------------+\n| Note | 1699 | SET PASSWORD has no significance for users authenticating via plugins |\n+-------+------+-----------------------------------------------------------------------+\n1 row in set (0.00 sec)\nMariaDB [(none)]><\/pre>\n\n\n\n<p>The above warning is telling me that the user root does not use the password table to log in.  It uses a unix (linux) socket, that is, the same authorization that allows the root user to validate.  But on my default Raspian Linux installation, I use <code>sudo<\/code> and never log in as root.  I don&#8217;t know the root password, or even if there is one.  <strong>It is therefore unnecessary for me to set the root password on mariadb.<\/strong>  But then, how will I log in with all privileges if I need to do something on mariadb?  No problem, just use <code>sudo<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo mariadb -u root\n[sudo] password for myself:\nWelcome to the MariaDB monitor. Commands end with ; or \\g.\nYour MariaDB connection id is 6132\nServer version: 10.1.44-MariaDB-0+deb9u1 Raspbian 9.11\nCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\nMariaDB [(none)]>\n$<\/pre>\n\n\n\n<p>If your mariadb or mysql installation is different, the above may not apply to you.  The only reason I wrote this article was that things had changed from my recollections of how mysql worked years ago.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Bottom line: It may not be necessary to reset the root password for your mariadb. With a recent compromise of my wordpress server on a Raspberry Pi, I thought it best to change database user passwords as a precaution. Resetting my own password was simple: $ mariadb -u myself -p Enter password: Welcome to the &hellip; <a href=\"http:\/\/pididu.com\/wordpress\/blog\/reset-root-password-for-mariadb\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Reset root password for mariadb<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[166],"tags":[276,277,275],"_links":{"self":[{"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/posts\/2696"}],"collection":[{"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/comments?post=2696"}],"version-history":[{"count":0,"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/posts\/2696\/revisions"}],"wp:attachment":[{"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/media?parent=2696"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/categories?post=2696"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/tags?post=2696"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}