{"id":1123,"date":"2017-03-01T10:53:11","date_gmt":"2017-03-01T02:53:11","guid":{"rendered":"http:\/\/www.poloo.org\/?p=1123"},"modified":"2017-03-01T10:57:22","modified_gmt":"2017-03-01T02:57:22","slug":"%e5%9c%a8ubuntu%e4%b8%8b%e7%9a%84mysql%e6%9b%b4%e6%94%b9%e6%95%b0%e6%8d%ae%e5%ba%93%e5%ad%98%e5%82%a8%e4%bd%8d%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/www.poloo.org\/?p=1123","title":{"rendered":"\u5728Ubuntu\u4e0b\u7684MySQL\u66f4\u6539\u6570\u636e\u5e93\u5b58\u50a8\u4f4d\u7f6e"},"content":{"rendered":"<p class=\"p1\">\u7cfb\u7edf\u7248\u672c\uff1aubuntu 14<br \/>\nMySQL\u7248\u672c\uff1a5.7.14<\/p>\n<pre class=\"brush:shell\">\u6570\u636e\u5e93\u4f4d\u7f6e\uff1a \/var\/lib\/mysql\/\r\n\r\n\u914d\u7f6e\u6587\u4ef6\u4f4d\u7f6e\uff1a \/etc\/mysql\/mysql.conf.d\/mysqld.cnf\r\n\r\n\u670d\u52a1\u811a\u672c\u4f4d\u7f6e\uff1a\/etc\/init.d\/mysql<\/pre>\n<p class=\"p1\"><!--more--><\/p>\n<p class=\"p1\">\u505c\u6b62\u6570\u636e\u5e93<\/p>\n<pre class=\"brush:shell\">service mysql stop<\/pre>\n<p class=\"p1\">\n<p class=\"p1\">\n<pre class=\"brush:shell\">\u4fee\u6539\u6570\u636e\u5e93\u4f4d\u7f6e\u4e3a\uff1a \/data\/mysql\/ \u00a0\u5e76 mv \u6570\u636e\u5e93\u5230\u6b64\u76ee\u5f55\r\n\r\n\u4fee\u6539\u914d\u7f6e\u6587\u4ef6 mysqld.cnf \u7684datadir \u914d\u7f6e\r\n\r\n\u4fee\u6539\u670d\u52a1\u542f\u52a8\u811a\u672c \u00a0MYSQLDATA=$(get_mysql_option mysqld datadir \"\/var\/lib\/mysql\u201d) \u4e3a \/data\/mysql\r\n\r\n\u4fee\u6539 \/usr\/bin\/mysqld_safe \u6587\u4ef6\u00a0DATADIR=\/var\/lib\/mysql \u4e3a \/data\/mysql\r\n\r\n\uff0a\u4fee\u6539 \/etc\/apparmor.d\/usr.sbin.mysqld<\/pre>\n<p class=\"p1\">\uff08\u5728ubuntu 710\u4e4b\u540e\uff0c\u589e\u52a0\u4e86\u7c7b\u4f3c\u4e8eSelinux\u7684\u6743\u9650\u63a7\u5236\u670d\u52a1 AppArmor\uff0c\u5728\u4fee\u6539\u4e86mysql\u6570\u636e\u5e93\u5b58\u50a8\u4f4d\u7f6e\u540e\uff0c\u9700\u8981\u4fee\u6539apparmor\u5173\u4e8emysql\u6587\u4ef6\u5939\u6743\u9650\u7684\u914d\u7f6e\uff0c\u5426\u5219mysql \u4e0d\u80fd\u542f\u52a8\u6210\u529f\uff09<\/p>\n<p class=\"p1\">\u66f4\u6539\u6570\u636e\u5e93\u6587\u4ef6\u5939\u76f8\u5173\u5185\u5bb9<\/p>\n<pre class=\"brush:sql\">\/data\/mysql\/ r,\r\n\r\n\/data\/mysql\/** rwk,\r\n\r\n<\/pre>\n<p>mv \u6570\u636e\u5e93\u5b8c\u6210\u540e\u542f\u52a8\u6570\u636e\u5e93\u670d\u52a1<\/p>\n<pre class=\"brush:shell\">chown -R mysql:mysql \/data\/mysql\r\n\r\nsudo \/etc\/init.d\/apparmor reload\r\n\r\nsudo \/etc\/init.d\/mysql start\r\n\r\n\uff08service mysql start\uff09<\/pre>\n<p class=\"p1\">Done<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7cfb\u7edf\u7248\u672c\uff1aubuntu 14 MySQL\u7248\u672c\uff1a5.7.14 \u6570\u636e\u5e93\u4f4d&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":1124,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,17],"tags":[38,67],"class_list":["post-1123","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-DB","category-Linux","tag-mysql","tag-ubuntu"],"_links":{"self":[{"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/posts\/1123","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.poloo.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1123"}],"version-history":[{"count":8,"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/posts\/1123\/revisions"}],"predecessor-version":[{"id":1132,"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/posts\/1123\/revisions\/1132"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/media\/1124"}],"wp:attachment":[{"href":"https:\/\/www.poloo.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.poloo.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.poloo.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}