{"id":294,"date":"2019-01-29T17:11:50","date_gmt":"2019-01-29T09:11:50","guid":{"rendered":"https:\/\/qtvz.com\/?p=294"},"modified":"2019-01-29T17:11:51","modified_gmt":"2019-01-29T09:11:51","slug":"mysql5-7%e4%bf%ae%e6%94%b9%e5%af%86%e7%a0%81","status":"publish","type":"post","link":"https:\/\/qtvz.com\/294.html","title":{"rendered":"MySQL5.7\u4fee\u6539\u5bc6\u7801"},"content":{"rendered":"<!--wp-compress-html--><!--wp-compress-html no compression-->\n<p><strong>\u5173\u95ed\u6b63\u5728\u8fd0\u884c\u7684 MySQL \uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>service mysql stop<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"> <strong>\u8fd0\u884c<\/strong> <\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>mysqld_safe --skip-grant-tables &amp;<\/code><\/pre>\n\n\n\n<p><strong>\u4e3a\u4e86\u5b89\u5168\u53ef\u4ee5\u8fd9\u6837\u7981\u6b62\u8fdc\u7a0b\u8fde\u63a5\uff1a<\/strong><\/p>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysqld_safe --skip-grant-tables --skip-networking &amp;<\/code><\/pre>\n\n\n\n<p><strong>\u4f7f\u7528mysql\u8fde\u63a5server\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql -p<\/code><\/pre>\n\n\n\n<p><strong>\u66f4\u6539\u5bc6\u7801\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost';<\/code><\/pre>\n\n\n\n<p><strong>*\u7279\u522b\u63d0\u9192\u6ce8\u610f\u7684\u4e00\u70b9\u662f\uff0c\u65b0\u7248\u7684mysql\u6570\u636e\u5e93\u4e0b\u7684user\u8868\u4e2d\u5df2\u7ecf\u6ca1\u6709Password\u5b57\u6bb5\u4e86<\/strong><\/p>\n\n\n\n<p><strong>\u800c\u662f\u5c06\u52a0\u5bc6\u540e\u7684\u7528\u6237\u5bc6\u7801\u5b58\u50a8\u4e8eauthentication_string\u5b57\u6bb5<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql> flush privileges;\nmysql> quit;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"> \u4fee\u6539\u5b8c\u6bd5\u3002\u91cd\u542f<br>[root@localhost ~]# service mysql restart <\/pre>\n\n\n\n<p><strong>MySQL\u7ba1\u7406\u8005\u5bc6\u7801\u8bbe\u7f6e\u6216\u4fee\u6539\uff1a<\/strong><\/p>\n\n\n\n<p>\u4f9d\u636e\u5b98\u65b9\u8bf4\u660e5.6\u4ee5\u540e\u7248\u672c\uff0c\u7b2c\u4e00\u6b21\u542f\u52a8\u65f6\u4f1a\u5728root\u76ee\u5f55\u4e0b\u751f\u4ea7\u4e00\u4e2a\u968f\u673a\u5bc6\u7801\uff0c\u6587\u4ef6\u540d.mysql_secret\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[root@bright ~]# cat \/root\/.mysql_secret\n# Password set for user 'root@localhost' at 2015-03-27 23:12:10\n:Jj+FTiqvyrF\n[root@bright ~]# cd \/usr\/local\/mysql\/bin\/\n[root@bright bin]# .\/mysqladmin -u root -h localhost password '123456' -p<\/code><\/pre>\n\n\n\n<p>Enter password: #\u6b64\u884c\u8f93\u5165.mysql_secret\u91cc\u7b2c\u4e8c\u884c\u5185\u5bb9<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysqladmin: [Warning] Using a password on the command line interface can be insecure.\nWarning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.<\/code><\/pre>\n\n\n\n<p>\u5b98\u65b9\u7684\u65b9\u5f0f\uff0c\u7b14\u8005\u65e0\u8bba\u662f\u5426\u4f7f\u7528--skip-grant-tables\u542f\u52a8mysql\u90fd\u6d4b\u8bd5\u5931\u8d25\uff0c\u4eb2\u4eec\u53ef\u4ee5\u6d4b\u8bd5\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>shell>mysql -uroot -p'password' #password\u5373.mysql_secret\u91cc\u7684\u5bc6\u7801\nmysql>SET PASSWORD = PASSWORD('newpasswd');<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img src=\"http:\/\/files.jb51.net\/file_images\/article\/201601\/2016111151524079.jpg?2016011151539\" alt=\"\" alt=\"MySQL5.7\u4fee\u6539\u5bc6\u7801 MySql\u8d44\u6599 \u7b2c1\u5f20\" title=\"MySQL5.7\u4fee\u6539\u5bc6\u7801 MySql\u8d44\u6599 \u7b2c1\u5f20-Qtvz\" ><\/figure>\n\n\n\n<p>\u65e7\u7248\u672c\uff0c\u5b89\u88c5\u540eROOT\u65e0\u5bc6\u7801\uff0c\u6309\u5982\u4e0b\u64cd\u4f5c\uff1a<\/p>\n\n\n\n<p><strong>\u65b9\u6cd5\u4e00\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>shell>service mysqld stop #\u505c\u6b62mysql\u670d\u52a1\nshell>mysqld_safe --skip-grant-tables &amp; #\u4ee5\u4e0d\u542f\u7528grant-tables\u6a21\u5f0f\u542f\u52a8mysql\nshell>mysql -uroot -p #\u8f93\u5165\u547d\u4ee4\u56de\u8f66\u8fdb\u5165\uff0c\u51fa\u73b0\u8f93\u5165\u5bc6\u7801\u63d0\u793a\u76f4\u63a5\u56de\u8f66\u3002\nmysql>use mysql;\nmysql>update user set password=PASSWORD(\"123456\")where user=\"root\"; #\u66f4\u6539\u5bc6\u7801\u4e3a newpassord\nmysql>flush privileges; #\u66f4\u65b0\u6743\u9650\nmysql>quit #\u9000\u51fa<\/code><\/pre>\n\n\n\n<p><strong>\u65b9\u6cd5\u4e8c\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>shell>service mysqld stop #\u505c\u6b62mysql\u670d\u52a1\nshell>mysqld_safe --skip-grant-tables &amp; #\u4ee5\u4e0d\u542f\u7528grant-tables\u6a21\u5f0f\u542f\u52a8mysql\nshell>mysql -uroot -p #\u8f93\u5165\u547d\u4ee4\u56de\u8f66\u8fdb\u5165\uff0c\u51fa\u73b0\u8f93\u5165\u5bc6\u7801\u63d0\u793a\u76f4\u63a5\u56de\u8f66\u3002\nmysql > set password for root@localhost = password('mysqlroot');<\/code><\/pre>\n\n\n\n<p><strong>\u65b9\u6cd5\u4e09\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>shell>\/path\/mysqladmin -u UserName -h Host password 'new_password' -p<\/code><\/pre>\n\n\n\n<p>\u539f\u6587:http:\/\/www.cnblogs.com\/xiaotengyi\/p\/5458731.html<\/p>\n<!--wp-compress-html no compression--><!--wp-compress-html-->","protected":false},"excerpt":{"rendered":"\u5173\u95ed\u6b63\u5728\u8fd0\u884c\u7684 MySQL \uff1a \u8fd0\u884c \u4e3a\u4e86\u5b89\u5168\u53ef\u4ee5\u8fd9\u6837\u7981\u6b62\u8fdc\u7a0b\u8fde\u63a5\uff1a \u4f7f\u7528mysql\u8fde\u63a5server\uff1a \u66f4\u6539\u5bc6\u7801\uff1a *\u7279\u522b\u63d0\u9192\u6ce8\u610f\u7684\u4e00\u70b9\u662f\uff0c\u65b0\u7248\u7684mysql\u6570\u636e\u5e93\u4e0b\u7684user\u8868\u4e2d\u5df2\u7ecf\u6ca1\u6709Passwor \u00b7\u00b7\u00b7","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[30],"tags":[76],"views":16905,"_links":{"self":[{"href":"https:\/\/qtvz.com\/api\/wp\/v2\/posts\/294"}],"collection":[{"href":"https:\/\/qtvz.com\/api\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qtvz.com\/api\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qtvz.com\/api\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qtvz.com\/api\/wp\/v2\/comments?post=294"}],"version-history":[{"count":1,"href":"https:\/\/qtvz.com\/api\/wp\/v2\/posts\/294\/revisions"}],"predecessor-version":[{"id":295,"href":"https:\/\/qtvz.com\/api\/wp\/v2\/posts\/294\/revisions\/295"}],"wp:attachment":[{"href":"https:\/\/qtvz.com\/api\/wp\/v2\/media?parent=294"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qtvz.com\/api\/wp\/v2\/categories?post=294"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qtvz.com\/api\/wp\/v2\/tags?post=294"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}