{"id":1147,"date":"2019-01-31T10:05:40","date_gmt":"2019-01-31T02:05:40","guid":{"rendered":"http:\/\/www.haku.studio\/?p=1111"},"modified":"2019-01-31T10:05:40","modified_gmt":"2019-01-31T02:05:40","slug":"mysql%e5%b0%86%e8%bf%9c%e7%a8%8b%e6%95%b0%e6%8d%ae%e5%ba%93%e5%bc%84%e5%88%b0%e6%9c%ac%e5%9c%b0-2","status":"publish","type":"post","link":"https:\/\/bloo.heing.fun\/?p=1147","title":{"rendered":"mysql"},"content":{"rendered":"<h3><strong>. mysqldump\u5de5\u5177\u57fa\u672c\u7528\u6cd5\uff0c\u4e0d\u9002\u7528\u4e8e\u5927\u6570\u636e\u5907\u4efd<\/strong><\/h3>\n<div>\u00a0<\/div>\n<div>1. \u5907\u4efd\u6240\u6709\u6570\u636e\u5e93: mysqldump -u root -p\u00a0&#8211;all-databases\u00a0&gt; all_database_sql<\/div>\n<div>2. \u5907\u4efdmysql\u6570\u636e\u5e93\uff1amysqldump -u root -p\u00a0&#8211;databases\u00a0mysql &gt; mysql_database_sql<\/div>\n<div>3. \u5907\u4efd\u6307\u5b9a\u7684\u591a\u4e2a\u6570\u636e\u5e93\uff1amysqldump -u root -p &#8211;databases db1 db2 db3 &gt; bak.sql<\/div>\n<div>4. \u5907\u4efdmysql\u6570\u636e\u5e93\u4e0b\u7684user\u8868\uff1amysqldump -u root -p mysql user &gt; user_table<\/div>\n<h3>\u8fde\u63a5\u5230\u8fdc\u7a0b\u4e3b\u673a\u4e0a\u7684MYSQL<\/h3>\n<p>\u547d\u4ee4\uff1amysql -h [host] -u [username] -p [password]<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/blog.csdn.net\/ycisacat\/article\/details\/52587529\">here<\/a><\/p>\n<p>\u8fd9\u672c\u6765\u662f\u5f88\u4e45\u5f88\u4e45\u4e4b\u524d\u5b66\u4e60\u7684\u7b14\u8bb0,\u4e00\u76f4\u4ee5txt\u5f62\u5f0f\u8bb0\u5f55\u5728\u7535\u8111\u4e0a,\u6700\u8fd1\u53d1\u73b0\u8fd8\u662f\u6709\u5fc5\u8981\u5199\u51fa\u6765,\u65b9\u4fbf\u871c\u6c41\u5931\u5fc6\u7684\u81ea\u5df1\u7ecf\u5e38\u56de\u987e<\/p>\n<p>\u5b8c\u6574\u547d\u4ee4:<\/p>\n<p>mysqldump -h &#8216;114.212.111.123&#8217; -uTHATUSER -pTHATPWD &#8211;opt &#8211;compress THATDB &#8211;skip-lock-tables | mysql -h localhost -uMYUSER -pMYPWD MYDB<br \/>1<br \/>\u89e3\u91ca\uff1a <br \/>114.212.111.123 \u8fdc\u7a0b\u670d\u52a1\u5668\u540d\u79f0 <br \/>THATUSER \u8fdc\u7a0b\u6570\u636e\u5e93\u767b\u5f55\u540d <br \/>THATPWD \u8fdc\u7a0b\u6570\u636e\u5e93\u767b\u5f55\u5bc6\u7801 <br \/>THATDB\u8fdc\u7a0b\u6570\u636e\u5e93\u540d\uff08\u5373\uff1a\u590d\u5236\u7684\u6e90\uff09 <br \/>localhost \u672c\u5730\u6570\u636e\u5e93\u540d\u79f0 <br \/>MYUSER \u672c\u5730\u6570\u636e\u5e93\u767b\u5f55\u540d <br \/>MYUSER \u672c\u5730\u6570\u636e\u5e93\u767b\u5f55\u5bc6\u7801 <br \/>MYDB \u672c\u5730\uff08\u5373\uff1a\u590d\u5236\u7684\u76ee\u7684\uff09 <br \/>sql\u89e3\u91ca\uff1a <br \/>mysqldump \u662fmysql\u7684\u4e00\u4e2a\u4e13\u95e8\u7528\u4e8e\u62f7\u8d1d\u64cd\u4f5c\u7684\u547d\u4ee4 <br \/>\u2013opt \u64cd\u4f5c\u7684\u610f\u601d <br \/>\u2013compress \u538b\u7f29\u8981\u4f20\u8f93\u7684\u6570\u636e <br \/>\u2013skip-lock \u5ffd\u7565\u9501\u4f4f\u7684\u8868\uff08\u52a0\u4e0a\u8fd9\u53e5\u80fd\u9632\u6b62\u5f53\u8868\u6709\u5916\u952e\u65f6\u7684\u62a5\u9519\uff09 <br \/>-tables \u67d0\u6570\u636e\u5e93\u6240\u6709\u8868 <br \/>-h \u670d\u52a1\u5668\u540d\u79f0 <br \/>-u \u7528\u6237\u540d\uff08*\u540e\u9762\u65e0\u7a7a\u683c\uff0c\u76f4\u63a5\u52a0\u7528\u6237\u540d\uff09 <br \/>-p \u5bc6\u7801\uff08*\u540e\u9762\u65e0\u7a7a\u683c\uff0c\u76f4\u63a5\u52a0\u5bc6\u7801,\u8fd9\u662f\u5fc5\u987b\u7684\uff09 <br \/>\u6ce8\u610f\uff1a <br \/>-u\u3001-p\u7684\u540e\u9762\u6ca1\u6709\u7a7a\u683c\uff0c\u76f4\u63a5\u52a0\u7528\u6237\u540d\u548c\u5bc6\u7801\uff01\uff01\uff01<\/p>\n<p>\u53e6\u5916\u4e0d\u91cd\u590d\u5730\u628a\u65e7\u8868\u590d\u5236\u5230\u65b0\u8868\u7684\u547d\u4ee4: <br \/>(\u4e0d\u4f1a\u8986\u76d6\u539f\u6709\u5185\u5bb9,\u4f1a\u53e0\u52a0\u5728\u540e\u9762)<\/p>\n<p>insert into table1 select * from table2 where not exists(select * from table1 where table1.user_id=table2.user_id and newtb.\u5b57\u6bb52=oldtb.\u5b57\u6bb52&#8230;.);<br \/>1<br \/>PS:\u82e5id auto_increment+primary key\u65e0\u6cd5\u63d2\u5165,\u5219\u5728phpadmin\u4e0b,\u628a\u6b63\u8868\u548c\u526f\u672c\u7684id\u53bb\u6389,\u590d\u5236,\u518d\u628aid\u52a0\u4e0a.\u6570\u636e\u592a\u591a\u7684\u65f6\u5019\u5fc5\u987b\u5728\u7ec8\u7aef\u4e0b\u79fb\u52a8.<br \/>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; <br \/>\u4f5c\u8005\uff1aycisacat <br \/>\u6765\u6e90\uff1aCSDN <br \/>\u539f\u6587\uff1ahttps:\/\/blog.csdn.net\/ycisacat\/article\/details\/52587529 <br \/>\u7248\u6743\u58f0\u660e\uff1a\u672c\u6587\u4e3a\u535a\u4e3b\u539f\u521b\u6587\u7ae0\uff0c\u8f6c\u8f7d\u8bf7\u9644\u4e0a\u535a\u6587\u94fe\u63a5\uff01<\/p>\n<p><audio style=\"display: none;\" controls=\"controls\"><\/audio><\/p>\n<p><audio style=\"display: none;\" controls=\"controls\"><\/audio><\/p>\n<p><audio style=\"display: none;\" controls=\"controls\"><\/audio><\/p>\n<p><audio style=\"display: none;\" controls=\"controls\"><\/audio><\/p>\n","protected":false},"excerpt":{"rendered":"<p>. mysqldump\u5de5\u5177\u57fa\u672c\u7528\u6cd5\uff0c\u4e0d\u9002\u7528\u4e8e\u5927\u6570\u636e\u5907\u4efd \u00a0 1. \u5907\u4efd\u6240\u6709\u6570\u636e\u5e93: mysqldump -u  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-1147","post","type-post","status-publish","format-standard","hentry","category-36"],"_links":{"self":[{"href":"https:\/\/bloo.heing.fun\/index.php?rest_route=\/wp\/v2\/posts\/1147","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bloo.heing.fun\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bloo.heing.fun\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bloo.heing.fun\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bloo.heing.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1147"}],"version-history":[{"count":0,"href":"https:\/\/bloo.heing.fun\/index.php?rest_route=\/wp\/v2\/posts\/1147\/revisions"}],"wp:attachment":[{"href":"https:\/\/bloo.heing.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1147"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bloo.heing.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1147"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bloo.heing.fun\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1147"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}