{"id":488,"date":"2009-10-13T01:04:25","date_gmt":"2009-10-12T23:04:25","guid":{"rendered":"http:\/\/raftaman.net\/?p=488"},"modified":"2021-05-15T11:46:41","modified_gmt":"2021-05-15T09:46:41","slug":"resetting-mysql-root-password","status":"publish","type":"post","link":"https:\/\/possiblelossofprecision.net\/?p=488","title":{"rendered":"Resetting MySQL root password"},"content":{"rendered":"<p>It shouldn&#8217;t happen, but it does: I forgot my MySQL root password. Resetting is rather simple. Stop the running mysqld instance and restart it in safe mode:<\/p>\n<pre class=\"brush: bash; highlight: [1]; title: ; notranslate\" title=\"\">\r\n# mysqld_safe --skip-grant-tables &amp;\r\n<\/pre>\n<p>You can now log in as root without a password:<\/p>\n<pre class=\"brush: bash; highlight: [1,10,14,17,19]; title: ; notranslate\" title=\"\">\r\n# mysql --user=root\r\nWelcome to the MariaDB monitor.  Commands end with ; or \\g.\r\nYour MariaDB connection id is 1\r\nServer version: 5.5.35-MariaDB MariaDB Server\r\n\r\nCopyright (c) 2000, 2013, Oracle, Monty Program Ab and others.\r\n\r\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\r\n\r\nMariaDB &#x5B;(none)]&gt; update mysql.user set Password=PASSWORD('your_new_root_password') where User='root';\r\nQuery OK, 3 rows affected (0.00 sec)\r\nRows matched: 3  Changed: 3  Warnings: 0\r\n\r\nMariaDB &#x5B;(none)]&gt; flush privileges;\r\nQuery OK, 0 rows affected (0.01 sec)\r\n\r\nMariaDB &#x5B;(none)]&gt; quit;\r\nBye\r\n# pkill mysqld\r\n<\/pre>\n<p>Don&#8217;t forget restart the mysql server and clear <code>~\/.mysql_history<\/code> afterwards!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It shouldn&#8217;t happen, but it does: I forgot my MySQL root password. Resetting is rather simple. Stop the running mysqld instance and restart it in safe mode: # mysqld_safe &#8211;skip-grant-tables &amp; You can now log in as root without a password: # mysql &#8211;user=root Welcome to the MariaDB monitor. Commands end with ; or \\g. Your MariaDB connection id is&#8230; <a href=\"https:\/\/possiblelossofprecision.net\/?p=488\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[22],"class_list":["post-488","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-mysql"],"_links":{"self":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/488","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=488"}],"version-history":[{"count":4,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/488\/revisions"}],"predecessor-version":[{"id":1779,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/488\/revisions\/1779"}],"wp:attachment":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=488"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=488"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=488"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}