{"id":27,"date":"2007-01-30T12:19:00","date_gmt":"2007-01-30T19:19:00","guid":{"rendered":"http:\/\/sp2hari.com\/?p=27"},"modified":"2020-06-20T08:57:36","modified_gmt":"2020-06-20T08:57:36","slug":"forgot-mysql-root-pass","status":"publish","type":"post","link":"https:\/\/sp2hari.com\/index.php\/2007\/01\/30\/forgot-mysql-root-pass\/","title":{"rendered":"Forgot mysql root pass ?"},"content":{"rendered":"<p>Recently forgot mysql root password for one of the servers i maintain . Little bit googling helped me to reset the password .<br \/>\nJust copy pasted the tutorials i saw so that i need not google again .<\/p>\n<p>If you have set a <code>root<\/code> password, but forgot what it was, you can set a new       password with the following procedure:<\/p>\n<ol>\n<li>Take down the <code>mysqld<\/code> server by sending a <code>kill<\/code> (not <code>kill           -9<\/code>) to the <code>mysqld<\/code> server. The pid is stored in a <tt>`.pid'<\/tt> file,           which is normally in the MySQL database directory:\n<pre>shell&gt; kill `cat \/mysql-data-directory\/hostname.pid`\n<\/pre>\n<p>You must be either the Unix <code>root<\/code> user or the same user <code>mysqld<\/code>           runs as to do this.<\/li>\n<li>Restart <code>mysqld<\/code> with the <code>--skip-grant-tables<\/code> option.<\/li>\n<li>Set a new password with the <code>mysqladmin password<\/code> command:\n<pre>shell&gt; mysqladmin -u root password 'mynewpassword'\n<\/pre>\n<\/li>\n<li>Now you can either stop <code>mysqld<\/code> and restart it normally, or just load the           privilege tables with:\n<pre>shell&gt; mysqladmin -h hostname flush-privileges\n<\/pre>\n<\/li>\n<li>After this, you should be able to connect using the new password.<\/li>\n<\/ol>\n<p>Alternatively, you can set the new password using the <code>mysql<\/code> client:<\/p>\n<ol>\n<li>Take down and restart <code>mysqld<\/code> with the <code>--skip-grant-tables<\/code>           option as described above.<\/li>\n<li>Connect to the <code>mysqld<\/code> server with:\n<pre>shell&gt; mysql -u root mysql\n<\/pre>\n<\/li>\n<li>Issue the following commands in the <code>mysql<\/code> client:\n<pre>mysql&gt; UPDATE user SET Password=PASSWORD('mynewpassword')\n   -&gt;             WHERE User='root';\nmysql&gt; FLUSH PRIVILEGES;\n<\/pre>\n<\/li>\n<li>After this, you should be able to connect using the new password.<\/li>\n<li>You can now stop <code>mysqld<\/code> and restart it normally.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Recently forgot mysql root password for one of the servers i maintain . Little bit googling helped me to reset the password . Just copy pasted the tutorials i saw so that i need not google again . If you have set a root password, but forgot what it was, &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-27","post","type-post","status-publish","format-standard","hentry","category-code"],"_links":{"self":[{"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/posts\/27","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/comments?post=27"}],"version-history":[{"count":2,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/posts\/27\/revisions"}],"predecessor-version":[{"id":1443,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/posts\/27\/revisions\/1443"}],"wp:attachment":[{"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/media?parent=27"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/categories?post=27"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/tags?post=27"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}