{"id":110,"date":"2016-04-26T22:21:32","date_gmt":"2016-04-26T14:21:32","guid":{"rendered":"http:\/\/pony.blog.myhz.com\/?p=110"},"modified":"2017-03-21T20:50:24","modified_gmt":"2017-03-21T12:50:24","slug":"mysql%e5%b8%b8%e7%94%a8%e5%91%bd%e4%bb%a4","status":"publish","type":"post","link":"https:\/\/lnmp.ivan.xin\/?p=110","title":{"rendered":"mysql\u5e38\u7528\u547d\u4ee4"},"content":{"rendered":"<p>\u7528\u6237root\u7528\u6237\u767b\u9646<\/p>\n<p>\u6dfb\u52a0\u4e00\u4e2a\u672c\u5730\u7528\u6237\uff0c\u540d\u4e3ausername\u5bc6\u7801\u4e3apassword<\/p>\n<p>GRANT ALL PRIVILEGES ON *.* TO username@localhost IDENTIFIED BY 'password' WITH GRANT OPTION;<\/p>\n<p>\u6dfb\u52a0\u4e00\u4e2a\u8fdc\u7a0b\u7528\u6237\uff0c\u540d\u4e3ausername\u5bc6\u7801\u4e3apassword<br \/>\nGRANT ALL PRIVILEGES ON *.* TO username@\"%\" IDENTIFIED BY'password' WITH GRANT OPTION;<\/p>\n<p>\u6dfb\u52a0\u5b8c\u7528\u6237\u540e\u8981\u91cd\u65b0\u542f\u52a8mysql\u670d\u52a1<\/p>\n<p>mysql\u5b89\u5168\u7684\u91cd\u542f\u65b9\u6cd5<\/p>\n<p>$mysql_dir\/bin\/mysqladmin -u root -p shutdown<br \/>\n$mysql_dir\/bin\/safe_mysqld &amp;<\/p>\n<p>mysqladmin\u548cmysqld_safe\u4f4d\u4e8eMysql\u5b89\u88c5\u76ee\u5f55\u7684bin\u76ee\u5f55\u4e0b\uff0c\u5f88\u5bb9\u6613\u627e\u5230\u7684<\/p>\n<p>1 \u8fde\u63a5MYSQL<\/p>\n<p>\u683c\u5f0f\uff1a mysql -h\u4e3b\u673a\u5730\u5740 -u\u7528\u6237\u540d \uff0dp\u7528\u6237\u5bc6\u7801<\/p>\n<p>1\u3001\u4f8b1\uff1a\u8fde\u63a5\u5230\u672c\u673a\u4e0a\u7684MYSQL<\/p>\n<p>\u9996\u5148\u5728\u6253\u5f00DOS\u7a97\u53e3\uff0c\u7136\u540e\u8fdb\u5165\u76ee\u5f55 mysqlbin\uff0c\u518d\u952e\u5165\u547d\u4ee4mysql -uroot -p\uff0c\u56de\u8f66\u540e\u63d0\u793a\u4f60\u8f93\u5bc6\u7801\uff0c\u5982\u679c\u521a\u5b89\u88c5\u597dMYSQL\uff0c\u8d85\u7ea7\u7528\u6237root\u662f\u6ca1\u6709\u5bc6\u7801\u7684\uff0c\u6545\u76f4\u63a5\u56de\u8f66\u5373\u53ef\u8fdb\u5165\u5230MYSQL\u4e2d\u4e86\uff0cMYSQL\u7684\u63d0\u793a\u7b26\u662f\uff1amysql&gt;<\/p>\n<p>2\u3001\u4f8b2\uff1a\u8fde\u63a5\u5230\u8fdc\u7a0b\u4e3b\u673a\u4e0a\u7684MYSQL<\/p>\n<p>\u5047\u8bbe\u8fdc\u7a0b\u4e3b\u673a\u7684IP\u4e3a\uff1a110.110.110.110\uff0c\u7528\u6237\u540d\u4e3aroot,\u5bc6\u7801\u4e3aabcd123\u3002\u5219\u952e\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<p>mysql -h110.110.110.110 -uroot -pabcd123<\/p>\n<p>\uff08\u6ce8:u\u4e0eroot\u53ef\u4ee5\u4e0d\u7528\u52a0\u7a7a\u683c\uff0c\u5176\u5b83\u4e5f\u4e00\u6837\uff09<\/p>\n<p>3\u3001\u9000\u51faMYSQL\u547d\u4ee4\uff1a exit \uff08\u56de\u8f66\uff09<br \/>\n2 \u4fee\u6539\u5bc6\u7801<\/p>\n<p>\u683c\u5f0f\uff1amysqladmin -u\u7528\u6237\u540d -p\u65e7\u5bc6\u7801 password \u65b0\u5bc6\u7801<\/p>\n<p>1\u3001\u4f8b1\uff1a\u7ed9root\u52a0\u4e2a\u5bc6\u7801ab12\u3002\u9996\u5148\u5728DOS\u4e0b\u8fdb\u5165\u76ee\u5f55mysqlbin\uff0c\u7136\u540e\u952e\u5165\u4ee5\u4e0b\u547d\u4ee4<\/p>\n<p>mysqladmin -uroot -password ab12<\/p>\n<p>\u6ce8\uff1a\u56e0\u4e3a\u5f00\u59cb\u65f6root\u6ca1\u6709\u5bc6\u7801\uff0c\u6240\u4ee5-p\u65e7\u5bc6\u7801\u4e00\u9879\u5c31\u53ef\u4ee5\u7701\u7565\u4e86\u3002<\/p>\n<p>2\u3001\u4f8b2\uff1a\u518d\u5c06root\u7684\u5bc6\u7801\u6539\u4e3adjg345<\/p>\n<p>mysqladmin -uroot -pab12 password djg345<\/p>\n<p>1:\u4f7f\u7528SHOW\u8bed\u53e5\u627e\u51fa\u5728\u670d\u52a1\u5668\u4e0a\u5f53\u524d\u5b58\u5728\u4ec0\u4e48\u6570\u636e\u5e93\uff1a<br \/>\nmysql&gt; SHOW DATABASES;<br \/>\n2:2\u3001\u521b\u5efa\u4e00\u4e2a\u6570\u636e\u5e93MYSQLDATA<br \/>\nmysql&gt; CREATE DATABASE MYSQLDATA;<br \/>\n3:\u9009\u62e9\u4f60\u6240\u521b\u5efa\u7684\u6570\u636e\u5e93<br \/>\nmysql&gt; USE MYSQLDATA; (\u6309\u56de\u8f66\u952e\u51fa\u73b0Database changed \u65f6\u8bf4\u660e\u64cd\u4f5c\u6210\u529f\uff01)<br \/>\n4:\u67e5\u770b\u73b0\u5728\u7684\u6570\u636e\u5e93\u4e2d\u5b58\u5728\u4ec0\u4e48\u8868<br \/>\nmysql&gt; SHOW TABLES;<br \/>\n5:\u521b\u5efa\u4e00\u4e2a\u6570\u636e\u5e93\u8868<br \/>\nmysql&gt; CREATE TABLE MYTABLE (name VARCHAR(20), sex CHAR(1));<br \/>\n6:\u663e\u793a\u8868\u7684\u7ed3\u6784\uff1a<br \/>\nmysql&gt; DESCRIBE MYTABLE;<br \/>\n7:\u5f80\u8868\u4e2d\u52a0\u5165\u8bb0\u5f55<br \/>\nmysql&gt; insert into MYTABLE values (\"hyq\",\"M\");<br \/>\n8:\u7528\u6587\u672c\u65b9\u5f0f\u5c06\u6570\u636e\u88c5\u5165\u6570\u636e\u5e93\u8868\u4e2d\uff08\u4f8b\u5982D:\/mysql.txt\uff09<br \/>\nmysql&gt; LOAD DATA LOCAL INFILE \"D:\/mysql.txt\" INTO TABLE MYTABLE;<br \/>\n9:\u5bfc\u5165.sql\u6587\u4ef6\u547d\u4ee4\uff08\u4f8b\u5982D:\/mysql.sql\uff09<br \/>\nmysql&gt;use database;<br \/>\nmysql&gt;source d:\/mysql.sql;<br \/>\n10:\u5220\u9664\u8868<br \/>\nmysql&gt;drop TABLE MYTABLE;<br \/>\n11:\u6e05\u7a7a\u8868<br \/>\nmysql&gt;delete from MYTABLE;<br \/>\n12:\u66f4\u65b0\u8868\u4e2d\u6570\u636e<br \/>\nmysql&gt;update MYTABLE set sex=\"f\" where name='hyq';<\/p>\n<p>\u5168\u5c40\u7ba1\u7406\u6743\u9650\uff1a<br \/>\nFILE: \u5728MySQL\u670d\u52a1\u5668\u4e0a\u8bfb\u5199\u6587\u4ef6\u3002<br \/>\nPROCESS: \u663e\u793a\u6216\u6740\u6b7b\u5c5e\u4e8e\u5176\u5b83\u7528\u6237\u7684\u670d\u52a1\u7ebf\u7a0b\u3002<br \/>\nRELOAD: \u91cd\u8f7d\u8bbf\u95ee\u63a7\u5236\u8868\uff0c\u5237\u65b0\u65e5\u5fd7\u7b49\u3002<br \/>\nSHUTDOWN: \u5173\u95edMySQL\u670d\u52a1\u3002<br \/>\n\u6570\u636e\u5e93\/\u6570\u636e\u8868\/\u6570\u636e\u5217\u6743\u9650\uff1a<br \/>\nALTER: \u4fee\u6539\u5df2\u5b58\u5728\u7684\u6570\u636e\u8868(\u4f8b\u5982\u589e\u52a0\/\u5220\u9664\u5217)\u548c\u7d22\u5f15\u3002<br \/>\nCREATE: \u5efa\u7acb\u65b0\u7684\u6570\u636e\u5e93\u6216\u6570\u636e\u8868\u3002<br \/>\nDELETE: \u5220\u9664\u8868\u7684\u8bb0\u5f55\u3002<br \/>\nDROP: \u5220\u9664\u6570\u636e\u8868\u6216\u6570\u636e\u5e93\u3002<br \/>\nINDEX: \u5efa\u7acb\u6216\u5220\u9664\u7d22\u5f15\u3002<br \/>\nINSERT: \u589e\u52a0\u8868\u7684\u8bb0\u5f55\u3002<br \/>\nSELECT: \u663e\u793a\/\u641c\u7d22\u8868\u7684\u8bb0\u5f55\u3002<br \/>\nUPDATE: \u4fee\u6539\u8868\u4e2d\u5df2\u5b58\u5728\u7684\u8bb0\u5f55\u3002<br \/>\n\u7279\u522b\u7684\u6743\u9650\uff1a<br \/>\nALL: \u5141\u8bb8\u505a\u4efb\u4f55\u4e8b(\u548croot\u4e00\u6837)\u3002<br \/>\nUSAGE: \u53ea\u5141\u8bb8\u767b\u5f55--\u5176\u5b83\u4ec0\u4e48\u4e5f\u4e0d\u5141\u8bb8\u505a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7528\u6237root\u7528\u6237\u767b\u9646 \u6dfb\u52a0\u4e00\u4e2a\u672c\u5730\u7528\u6237\uff0c\u540d\u4e3ausername\u5bc6\u7801\u4e3apassword GRANT ALL PRI...<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15330],"tags":[],"class_list":["post-110","post","type-post","status-publish","format-standard","hentry","category-mysql"],"_links":{"self":[{"href":"https:\/\/lnmp.ivan.xin\/index.php?rest_route=\/wp\/v2\/posts\/110","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lnmp.ivan.xin\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lnmp.ivan.xin\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lnmp.ivan.xin\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/lnmp.ivan.xin\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=110"}],"version-history":[{"count":0,"href":"https:\/\/lnmp.ivan.xin\/index.php?rest_route=\/wp\/v2\/posts\/110\/revisions"}],"wp:attachment":[{"href":"https:\/\/lnmp.ivan.xin\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lnmp.ivan.xin\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=110"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lnmp.ivan.xin\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}