{"id":6875,"date":"2017-07-21T16:05:28","date_gmt":"2017-07-21T08:05:28","guid":{"rendered":"http:\/\/rmohan.com\/?p=6875"},"modified":"2017-07-21T16:05:28","modified_gmt":"2017-07-21T08:05:28","slug":"mysql-5-7-forget-the-root-password","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6875","title":{"rendered":"MySQL 5.7 forget the root password"},"content":{"rendered":"<p><strong>surroundings<\/strong><\/p>\n<p><a title=\"CentOS\" href=\"http:\/\/www.linuxidc.com\/topicnews.aspx?tid=14\" target=\"_blank\" rel=\"noopener\">CentOS<\/a>\u00a06.6 X86_64<\/p>\n<p><strong>background<\/strong><\/p>\n<p>Forget how to do root, forget to initialize MySQL generated when the random password how to do, or simply did not register that random password, do not tell me to clear all the data under data, reinitialize, of course, you have to be so wayward can also be.<br \/>\nDo not pull, the following is the title.<\/p>\n<p><strong>reference<\/strong><\/p>\n<p><a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.7\/en\/resetting-permissions.html\">Http:\/\/dev.mysql.com\/doc\/refman\/5.7\/en\/resetting-permissions.html<\/a><\/p>\n<p><strong>operating<\/strong><\/p>\n<p>There are several ways in the official document, I read the next, you remember the following I said a bar, the other you try it, so good to make me no matter<\/p>\n<p>Use &#8211;skip-grant-tables to start mysql server<br \/>\nbin \/ mysqld_safe &#8211;user = mysql01 &#8211;skip-grant-tables &#8211; skip-networking &amp;<\/p>\n<p>Two options are meaning &#8211;<br \/>\nskip-grant-tables skip authorization &#8211;<br \/>\nskip-networking does not allow remote network connection<\/p>\n<p>Skip-networking can not, to prevent other users to connect the remote operation of the database, do not look at the actual situation.\u00a0Just learn an option.<\/p>\n<p>Client login<br \/>\nbin \/ mysql -uroot -p<br \/>\nupdate mysql.user set authentication_string = password (&#8216;root&#8217;), password_expired = &#8216;N&#8217; where user = &#8216;root&#8217;;<br \/>\nflush privileges;<\/p>\n<p>Change the password if you still remember ALTER USER &#8216;root&#8217; @ &#8216;localhost&#8217; IDENTIFIED BY &#8216;root&#8217;;<br \/>\nit is best not to use, it may prompt anonymous users do not allow to change the password and the like.<\/p>\n<p><strong>Description<\/strong><\/p>\n<p>All relevant directories, links, parameters, etc., please adjust according to the actual situation.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>surroundings<\/p>\n<p>CentOS 6.6 X86_64<\/p>\n<p>background<\/p>\n<p>Forget how to do root, forget to initialize MySQL generated when the random password how to do, or simply did not register that random password, do not tell me to clear all the data under data, reinitialize, of course, you have to be so wayward can also be. Do not [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6875"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6875"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6875\/revisions"}],"predecessor-version":[{"id":6876,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6875\/revisions\/6876"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6875"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6875"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6875"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}