{"id":597,"date":"2022-03-30T11:15:27","date_gmt":"2022-03-30T03:15:27","guid":{"rendered":"https:\/\/22pig.com\/?p=597"},"modified":"2022-03-30T11:15:27","modified_gmt":"2022-03-30T03:15:27","slug":"mysql%e8%bf%81%e7%a7%bb%e6%95%b0%e6%8d%ae%e7%9b%ae%e5%bd%95","status":"publish","type":"post","link":"http:\/\/22pig.com\/?p=597","title":{"rendered":"mysql\u8fc1\u79fb\u6570\u636e\u76ee\u5f55"},"content":{"rendered":"<article data-content=\"[{&quot;type&quot;:&quot;block&quot;,&quot;id&quot;:&quot;3060-1621846615933&quot;,&quot;name&quot;:&quot;paragraph&quot;,&quot;data&quot;:{},&quot;nodes&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;id&quot;:&quot;p5PQ-1621846617594&quot;,&quot;leaves&quot;:[{&quot;text&quot;:&quot;mysql\u8fc1\u79fb\u6570\u636e\u76ee\u5f55&quot;,&quot;marks&quot;:[]}]}],&quot;state&quot;:{}},{&quot;type&quot;:&quot;block&quot;,&quot;id&quot;:&quot;FBfd-1648609220277&quot;,&quot;name&quot;:&quot;paragraph&quot;,&quot;data&quot;:{},&quot;nodes&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;id&quot;:&quot;RGzH-1648609220276&quot;,&quot;leaves&quot;:[{&quot;text&quot;:&quot;&quot;,&quot;marks&quot;:[]}]}],&quot;state&quot;:{}},{&quot;type&quot;:&quot;block&quot;,&quot;id&quot;:&quot;KomG-1648609211284&quot;,&quot;name&quot;:&quot;paragraph&quot;,&quot;data&quot;:{&quot;style&quot;:{&quot;textAlign&quot;:&quot;left&quot;}},&quot;nodes&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;id&quot;:&quot;ktAP-1648609211283&quot;,&quot;leaves&quot;:[{&quot;text&quot;:&quot;\u7531\u4e8eMySql\u7684\u6570\u636e\u5e93\u6587\u4ef6\u548c\u65e5\u5fd7\u6587\u4ef6\u6bd4\u8f83\u5927\uff0c\u5bfc\u81f4\u78c1\u76d8\u7a7a\u95f4\u4e0d\u591f\uff0c\u5728\u6dfb\u52a0\u65b0\u7684\u78c1\u76d8\u4e4b\u540e\uff0c\u9700\u8981\u628aMySql\u7684\u6570\u636e\u8f6c\u79fb\u5230\u65b0\u6302\u8f7d\u7684\u76ee\u5f55\u4e0b\u3002&quot;,&quot;marks&quot;:[]}]}],&quot;state&quot;:{}},{&quot;type&quot;:&quot;block&quot;,&quot;id&quot;:&quot;EXWq-1648609217919&quot;,&quot;name&quot;:&quot;paragraph&quot;,&quot;data&quot;:{&quot;style&quot;:{&quot;textAlign&quot;:&quot;left&quot;},&quot;version&quot;:1},&quot;nodes&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;id&quot;:&quot;NXCE-1648609217918&quot;,&quot;leaves&quot;:[{&quot;text&quot;:&quot;\u00a0&quot;,&quot;marks&quot;:[]}]}],&quot;state&quot;:{}},{&quot;type&quot;:&quot;block&quot;,&quot;id&quot;:&quot;XSvc-1648609217921&quot;,&quot;name&quot;:&quot;paragraph&quot;,&quot;data&quot;:{&quot;style&quot;:{&quot;textAlign&quot;:&quot;left&quot;},&quot;version&quot;:1},&quot;nodes&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;id&quot;:&quot;392y-1648609217920&quot;,&quot;leaves&quot;:[{&quot;text&quot;:&quot;1.\u505c\u6b62MySql\u670d\u52a1\uff1b&quot;,&quot;marks&quot;:[]}]}],&quot;state&quot;:{}},{&quot;type&quot;:&quot;block&quot;,&quot;id&quot;:&quot;tJN4-1648609217923&quot;,&quot;name&quot;:&quot;paragraph&quot;,&quot;data&quot;:{&quot;style&quot;:{&quot;textAlign&quot;:&quot;left&quot;},&quot;version&quot;:1},&quot;nodes&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;id&quot;:&quot;J5Vq-1648609217922&quot;,&quot;leaves&quot;:[{&quot;text&quot;:&quot;\/etc\/rc.d\/init.d\/mysql stop&quot;,&quot;marks&quot;:[]}]}],&quot;state&quot;:{}},{&quot;type&quot;:&quot;block&quot;,&quot;id&quot;:&quot;tinc-1648609217925&quot;,&quot;name&quot;:&quot;paragraph&quot;,&quot;data&quot;:{&quot;style&quot;:{&quot;textAlign&quot;:&quot;left&quot;},&quot;version&quot;:1},&quot;nodes&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;id&quot;:&quot;t26l-1648609217924&quot;,&quot;leaves&quot;:[{&quot;text&quot;:&quot;\u6216\u8005 service mysql stop&quot;,&quot;marks&quot;:[]}]}],&quot;state&quot;:{}},{&quot;type&quot;:&quot;block&quot;,&quot;id&quot;:&quot;UYbJ-1648609217927&quot;,&quot;name&quot;:&quot;paragraph&quot;,&quot;data&quot;:{&quot;style&quot;:{&quot;textAlign&quot;:&quot;left&quot;},&quot;version&quot;:1},&quot;nodes&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;id&quot;:&quot;oMol-1648609217926&quot;,&quot;leaves&quot;:[{&quot;text&quot;:&quot;\u00a0&quot;,&quot;marks&quot;:[]}]}],&quot;state&quot;:{}},{&quot;type&quot;:&quot;block&quot;,&quot;id&quot;:&quot;xfx0-1648609217929&quot;,&quot;name&quot;:&quot;paragraph&quot;,&quot;data&quot;:{&quot;style&quot;:{&quot;textAlign&quot;:&quot;left&quot;},&quot;version&quot;:1},&quot;nodes&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;id&quot;:&quot;mHaW-1648609217928&quot;,&quot;leaves&quot;:[{&quot;text&quot;:&quot;2.\u786e\u8ba4MySql\u539f\u6765\u7684\u6570\u636e\u76ee\u5f55\uff0c\u67e5\u627edatadir\u914d\u7f6e\u9879,\u5e76\u4fee\u6539\u6210\u65b0\u7684\u6302\u8f7d\u76ee\u5f55&quot;,&quot;marks&quot;:[]}]}],&quot;state&quot;:{}},{&quot;type&quot;:&quot;block&quot;,&quot;id&quot;:&quot;nYV4-1648609217931&quot;,&quot;name&quot;:&quot;paragraph&quot;,&quot;data&quot;:{&quot;style&quot;:{&quot;textAlign&quot;:&quot;left&quot;},&quot;version&quot;:1},&quot;nodes&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;id&quot;:&quot;PT1h-1648609217930&quot;,&quot;leaves&quot;:[{&quot;text&quot;:&quot;vi \/etc\/my.cnf&quot;,&quot;marks&quot;:[]}]}],&quot;state&quot;:{}},{&quot;type&quot;:&quot;block&quot;,&quot;id&quot;:&quot;bMDd-1648609217933&quot;,&quot;name&quot;:&quot;paragraph&quot;,&quot;data&quot;:{&quot;style&quot;:{&quot;textAlign&quot;:&quot;left&quot;},&quot;version&quot;:1},&quot;nodes&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;id&quot;:&quot;RliA-1648609217932&quot;,&quot;leaves&quot;:[{&quot;text&quot;:&quot;datadir = \/home\/mysqldata\/mysql&quot;,&quot;marks&quot;:[]}]}],&quot;state&quot;:{}},{&quot;type&quot;:&quot;block&quot;,&quot;id&quot;:&quot;OEId-1648609217935&quot;,&quot;name&quot;:&quot;paragraph&quot;,&quot;data&quot;:{&quot;style&quot;:{&quot;textAlign&quot;:&quot;left&quot;},&quot;version&quot;:1},&quot;nodes&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;id&quot;:&quot;881I-1648609217934&quot;,&quot;leaves&quot;:[{&quot;text&quot;:&quot;\u00a0&quot;,&quot;marks&quot;:[]}]}],&quot;state&quot;:{}},{&quot;type&quot;:&quot;block&quot;,&quot;id&quot;:&quot;2Gr6-1648609217937&quot;,&quot;name&quot;:&quot;paragraph&quot;,&quot;data&quot;:{&quot;style&quot;:{&quot;textAlign&quot;:&quot;left&quot;},&quot;version&quot;:1},&quot;nodes&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;id&quot;:&quot;LDpH-1648609217936&quot;,&quot;leaves&quot;:[{&quot;text&quot;:&quot;3.\u8f6c\u539f\u6570\u636e\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\u5168\u90e8\u8f6c\u79fb\u5230\u65b0\u6302\u8f7d\u7684\u76ee\u5f55\uff1b&quot;,&quot;marks&quot;:[]}]}],&quot;state&quot;:{}},{&quot;type&quot;:&quot;block&quot;,&quot;id&quot;:&quot;nvEa-1648609217939&quot;,&quot;name&quot;:&quot;paragraph&quot;,&quot;data&quot;:{&quot;style&quot;:{&quot;textAlign&quot;:&quot;left&quot;},&quot;version&quot;:1},&quot;nodes&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;id&quot;:&quot;gWcw-1648609217938&quot;,&quot;leaves&quot;:[{&quot;text&quot;:&quot;#\u8f6c\u79fb\u6587\u4ef6&quot;,&quot;marks&quot;:[]}]}],&quot;state&quot;:{}},{&quot;type&quot;:&quot;block&quot;,&quot;id&quot;:&quot;NBv7-1648609217941&quot;,&quot;name&quot;:&quot;paragraph&quot;,&quot;data&quot;:{&quot;style&quot;:{&quot;textAlign&quot;:&quot;left&quot;},&quot;version&quot;:1},&quot;nodes&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;id&quot;:&quot;yCFH-1648609217940&quot;,&quot;leaves&quot;:[{&quot;text&quot;:&quot;mv \/var\/lib\/mysql\/* \/home\/mysqldata\/mysql&quot;,&quot;marks&quot;:[]}]}],&quot;state&quot;:{}},{&quot;type&quot;:&quot;block&quot;,&quot;id&quot;:&quot;GeZl-1648609217943&quot;,&quot;name&quot;:&quot;paragraph&quot;,&quot;data&quot;:{&quot;style&quot;:{&quot;textAlign&quot;:&quot;left&quot;},&quot;version&quot;:1},&quot;nodes&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;id&quot;:&quot;ggA0-1648609217942&quot;,&quot;leaves&quot;:[{&quot;text&quot;:&quot;\u00a0&quot;,&quot;marks&quot;:[]}]}],&quot;state&quot;:{}},{&quot;type&quot;:&quot;block&quot;,&quot;id&quot;:&quot;xFep-1648609217945&quot;,&quot;name&quot;:&quot;paragraph&quot;,&quot;data&quot;:{&quot;style&quot;:{&quot;textAlign&quot;:&quot;left&quot;},&quot;version&quot;:1},&quot;nodes&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;id&quot;:&quot;djTh-1648609217944&quot;,&quot;leaves&quot;:[{&quot;text&quot;:&quot;4.\u4fee\u6539\u65b0\u6302\u8f7d\u7684\u76ee\u5f55\u6743\u9650&quot;,&quot;marks&quot;:[]}]}],&quot;state&quot;:{}},{&quot;type&quot;:&quot;block&quot;,&quot;id&quot;:&quot;n9Cd-1648609217947&quot;,&quot;name&quot;:&quot;paragraph&quot;,&quot;data&quot;:{&quot;style&quot;:{&quot;textAlign&quot;:&quot;left&quot;},&quot;version&quot;:1},&quot;nodes&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;id&quot;:&quot;dCfN-1648609217946&quot;,&quot;leaves&quot;:[{&quot;text&quot;:&quot;chown -R mysql:mysql \/home\/mysqldata\/mysql&quot;,&quot;marks&quot;:[]}]}],&quot;state&quot;:{}},{&quot;type&quot;:&quot;block&quot;,&quot;id&quot;:&quot;B2oz-1648609217949&quot;,&quot;name&quot;:&quot;paragraph&quot;,&quot;data&quot;:{&quot;style&quot;:{&quot;textAlign&quot;:&quot;left&quot;},&quot;version&quot;:1},&quot;nodes&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;id&quot;:&quot;jBC1-1648609217948&quot;,&quot;leaves&quot;:[{&quot;text&quot;:&quot;\u00a0&quot;,&quot;marks&quot;:[]}]}],&quot;state&quot;:{}},{&quot;type&quot;:&quot;block&quot;,&quot;id&quot;:&quot;fIol-1648609217951&quot;,&quot;name&quot;:&quot;paragraph&quot;,&quot;data&quot;:{&quot;style&quot;:{&quot;textAlign&quot;:&quot;left&quot;},&quot;version&quot;:1},&quot;nodes&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;id&quot;:&quot;T0Pw-1648609217950&quot;,&quot;leaves&quot;:[{&quot;text&quot;:&quot;5.\u542f\u52a8MySql\u670d\u52a1\uff1b&quot;,&quot;marks&quot;:[]}]}],&quot;state&quot;:{}},{&quot;type&quot;:&quot;block&quot;,&quot;id&quot;:&quot;8t0B-1648609217953&quot;,&quot;name&quot;:&quot;paragraph&quot;,&quot;data&quot;:{&quot;style&quot;:{&quot;textAlign&quot;:&quot;left&quot;},&quot;version&quot;:1},&quot;nodes&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;id&quot;:&quot;ryGV-1648609217952&quot;,&quot;leaves&quot;:[{&quot;text&quot;:&quot;\/etc\/rc.d\/init.d\/mysql start&quot;,&quot;marks&quot;:[]}]}],&quot;state&quot;:{}},{&quot;type&quot;:&quot;block&quot;,&quot;id&quot;:&quot;gnHi-1648609217955&quot;,&quot;name&quot;:&quot;paragraph&quot;,&quot;data&quot;:{&quot;style&quot;:{&quot;textAlign&quot;:&quot;left&quot;},&quot;version&quot;:1},&quot;nodes&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;id&quot;:&quot;U2Tr-1648609217954&quot;,&quot;leaves&quot;:[{&quot;text&quot;:&quot;\u6216\u8005 service mysql start&quot;,&quot;marks&quot;:[]}]}],&quot;state&quot;:{}},{&quot;type&quot;:&quot;block&quot;,&quot;id&quot;:&quot;YSfp-1648609211430&quot;,&quot;name&quot;:&quot;paragraph&quot;,&quot;data&quot;:{},&quot;nodes&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;id&quot;:&quot;TXOI-1648609211429&quot;,&quot;leaves&quot;:[{&quot;text&quot;:&quot;&quot;,&quot;marks&quot;:[]}]}],&quot;state&quot;:{}},{&quot;type&quot;:&quot;block&quot;,&quot;id&quot;:&quot;Q9JK-1648609188899&quot;,&quot;name&quot;:&quot;paragraph&quot;,&quot;data&quot;:{},&quot;nodes&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;id&quot;:&quot;dus1-1648609188898&quot;,&quot;leaves&quot;:[{&quot;text&quot;:&quot;&quot;,&quot;marks&quot;:[]}]}],&quot;state&quot;:{}}]\">\n<div>mysql\u8fc1\u79fb\u6570\u636e\u76ee\u5f55<\/div>\n<div><\/div>\n<div>\u7531\u4e8eMySql\u7684\u6570\u636e\u5e93\u6587\u4ef6\u548c\u65e5\u5fd7\u6587\u4ef6\u6bd4\u8f83\u5927\uff0c\u5bfc\u81f4\u78c1\u76d8\u7a7a\u95f4\u4e0d\u591f\uff0c\u5728\u6dfb\u52a0\u65b0\u7684\u78c1\u76d8\u4e4b\u540e\uff0c\u9700\u8981\u628aMySql\u7684\u6570\u636e\u8f6c\u79fb\u5230\u65b0\u6302\u8f7d\u7684\u76ee\u5f55\u4e0b\u3002<\/div>\n<div><\/div>\n<div>1.\u505c\u6b62MySql\u670d\u52a1\uff1b<\/div>\n<div>\/etc\/rc.d\/init.d\/mysql stop<\/div>\n<div>\u6216\u8005 service mysql stop<\/div>\n<div><\/div>\n<div>2.\u786e\u8ba4MySql\u539f\u6765\u7684\u6570\u636e\u76ee\u5f55\uff0c\u67e5\u627edatadir\u914d\u7f6e\u9879,\u5e76\u4fee\u6539\u6210\u65b0\u7684\u6302\u8f7d\u76ee\u5f55<\/div>\n<div>vi \/etc\/my.cnf<\/div>\n<div>datadir = \/home\/mysqldata\/mysql<\/div>\n<div>\u5982\u679c\u8fc1\u79fb\u8d70\u6574\u4e2a\u76ee\u5f55\uff0c\u8fd8\u6709\u4e00\u4e2a\u53c2\u6570\u8981\u6539<\/div>\n<div>socket=\/var\/lib\/mysql\/mysql.sock<\/div>\n<div><\/div>\n<div>3.\u8f6c\u539f\u6570\u636e\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\u5168\u90e8\u8f6c\u79fb\u5230\u65b0\u6302\u8f7d\u7684\u76ee\u5f55\uff1b<\/div>\n<div>#\u8f6c\u79fb\u6587\u4ef6<\/div>\n<div>##mv \/var\/lib\/mysql\/* \/home\/mysqldata\/mysql<\/div>\n<div>cp -r \/var\/lib\/mysql \/home\/mysql<\/div>\n<div><\/div>\n<div>4.\u4fee\u6539\u65b0\u6302\u8f7d\u7684\u76ee\u5f55\u6743\u9650<\/div>\n<div>chown -R mysql:mysql \/home\/mysqldata\/mysql<\/div>\n<div><\/div>\n<div>5.\u542f\u52a8MySql\u670d\u52a1\uff1b<\/div>\n<div>\/etc\/rc.d\/init.d\/mysql start<\/div>\n<div>\u6216\u8005 service mysql start<\/div>\n<div><\/div>\n<div><\/div>\n<\/article>\n","protected":false},"excerpt":{"rendered":"<p>mysql\u8fc1\u79fb\u6570\u636e\u76ee\u5f55 \u7531\u4e8eMySql\u7684\u6570\u636e\u5e93\u6587\u4ef6\u548c\u65e5\u5fd7\u6587\u4ef6\u6bd4\u8f83\u5927\uff0c\u5bfc\u81f4\u78c1\u76d8\u7a7a\u95f4\u4e0d\u591f\uff0c\u5728\u6dfb\u52a0\u65b0\u7684\u78c1\u76d8\u4e4b\u540e\uff0c\u9700\u8981\u628aMySql\u7684\u6570\u636e\u8f6c\u79fb\u5230\u65b0\u6302\u8f7d\u7684\u76ee\u5f55\u4e0b\u3002 1.\u505c\u6b62MySql\u670d\u52a1\uff1b \/etc\/rc.d\/init.d\/mysql stop \u6216\u8005 service mysql stop 2.\u786e\u8ba4MySql\u539f\u6765\u7684\u6570\u636e\u76ee\u5f55\uff0c\u67e5\u627edatadir\u914d\u7f6e\u9879,\u5e76\u4fee\u6539\u6210\u65b0\u7684\u6302\u8f7d\u76ee\u5f55 vi \/etc\/my.cnf datadir = \/home\/mysqldata\/mysql \u5982\u679c\u8fc1\u79fb\u8d70\u6574\u4e2a\u76ee\u5f55\uff0c\u8fd8\u6709\u4e00\u4e2a\u53c2\u6570\u8981\u6539 socket=\/var\/lib\/mysql\/mysql.sock 3.\u8f6c\u539f\u6570\u636e\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\u5168\u90e8\u8f6c\u79fb\u5230\u65b0\u6302\u8f7d\u7684\u76ee\u5f55\uff1b #\u8f6c\u79fb\u6587\u4ef6 ##mv \/var\/lib\/mysql\/* \/home\/mysqldata\/mysql cp -r \/var\/lib\/mysql \/home\/mysql 4.\u4fee\u6539\u65b0\u6302\u8f7d\u7684\u76ee\u5f55\u6743\u9650 chown -R mysql:mysql \/home\/mysqldata\/mysql 5.\u542f\u52a8MySql\u670d\u52a1\uff1b \/etc\/rc.d\/init.d\/mysql start \u6216\u8005 service mysql start<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-597","post","type-post","status-publish","format-standard","hentry","category-java"],"_links":{"self":[{"href":"http:\/\/22pig.com\/index.php?rest_route=\/wp\/v2\/posts\/597","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/22pig.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/22pig.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/22pig.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/22pig.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=597"}],"version-history":[{"count":0,"href":"http:\/\/22pig.com\/index.php?rest_route=\/wp\/v2\/posts\/597\/revisions"}],"wp:attachment":[{"href":"http:\/\/22pig.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=597"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/22pig.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=597"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/22pig.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=597"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}