{"id":7538,"date":"2024-11-14T08:16:00","date_gmt":"2024-11-14T00:16:00","guid":{"rendered":"https:\/\/fwq.ai\/blog\/7538\/"},"modified":"2024-11-14T08:16:00","modified_gmt":"2024-11-14T00:16:00","slug":"docker%e5%ae%89%e8%a3%85mysql%e5%90%8e%ef%bc%8c%e6%9c%ac%e5%9c%b0%e6%97%a0%e6%b3%95%e8%bf%9e%e6%8e%a5%e6%80%8e%e4%b9%88%e5%8a%9e%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/7538\/","title":{"rendered":"Docker\u5b89\u88c5MySQL\u540e\uff0c\u672c\u5730\u65e0\u6cd5\u8fde\u63a5\u600e\u4e48\u529e\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173097027313903.jpg\" class=\"aligncenter\" title=\"Docker\u5b89\u88c5MySQL\u540e\uff0c\u672c\u5730\u65e0\u6cd5\u8fde\u63a5\u600e\u4e48\u529e\uff1f\u63d2\u56fe\" alt=\"Docker\u5b89\u88c5MySQL\u540e\uff0c\u672c\u5730\u65e0\u6cd5\u8fde\u63a5\u600e\u4e48\u529e\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5b89\u88c5\uff0c\u4f46\u672c\u5730\u65e0\u6cd5\u8fde\u63a5<\/strong><\/p>\n<p>\u5c1d\u8bd5\u901a\u8fc7docker\u754c\u9762\u8fd0\u884cmysql\u955c\u50cf\u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u7aef\u53e3\u53f73306\u88ab\u5360\u7528\uff0c\u5bfc\u81f4\u65e0\u6cd5\u4ece\u672c\u5730\u8fde\u63a5\u7684\u95ee\u9898\u3002<\/p>\n<p>\u8981\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u539f\u56e0\u5728\u4e8e\u6620\u5c04\u5230\u672c\u5730\u7aef\u53e3\u65f6\u9ed8\u8ba4\u4f7f\u7528\u7684\u4e0d\u662f3306\u7aef\u53e3\u3002\u9700\u8981\u6307\u5b9a\u4f7f\u7528\u4e0e\u6620\u5c04\u7684\u7aef\u53e3\u76f8\u5bf9\u5e94\u7684\u7aef\u53e3\u53f7\u8fdb\u884c\u8fde\u63a5\u3002<\/p>\n<p>\u8981\u4ece\u672c\u5730\u8bbf\u95eedocker\u4e2d\u7684mysql\uff0c\u7aef\u53e3\u6620\u5c04\u5982\u4e0b\uff1a<\/p>\n<pre>-p 33060:3306<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u610f\u5473\u7740\u5bb9\u5668\u5185\u76843306\u7aef\u53e3\u5c06\u6620\u5c04\u5230\u672c\u5730\u768433060\u7aef\u53e3\u3002\u56e0\u6b64\uff0c\u8fde\u63a5\u65f6\u5e94\u4f7f\u7528\u7aef\u53e333060\uff1a<\/p>\n<pre>mysql -p 33060 -u root -p<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u53e6\u5916\uff0c\u8fd8\u9700\u8981\u786e\u4fdd\u5bb9\u5668\u5185\u7684mysql\u7528\u6237\u88ab\u8bbe\u7f6e\u4e3a\u5141\u8bb8\u8fdc\u7a0b\u8fde\u63a5\u3002\u4e3a\u6b64\uff0c\u53ef\u4ee5\u5c06host\u8bbe\u7f6e\u4e3a%\uff1a<\/p>\n<pre>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password';\nFLUSH PRIVILEGES;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fDocker\u5b89\u88c5MySQL\u540e\uff0c\u672c\u5730\u65e0\u6cd5\u8fde\u63a5\u600e\u4e48\u529e\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b89\u88c5\uff0c\u4f46\u672c\u5730\u65e0\u6cd5\u8fde\u63a5 \u5c1d\u8bd5\u901a\u8fc7docker\u754c\u9762\u8fd0\u884cmysql\u955c\u50cf\u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u7aef\u53e3\u53f73306\u88ab\u5360\u7528\uff0c\u5bfc\u81f4\u65e0\u6cd5\u4ece\u672c\u5730\u8fde\u63a5\u7684\u95ee\u9898\u3002 \u8981\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u539f\u56e0\u5728\u4e8e\u6620\u5c04\u5230\u672c\u5730\u7aef\u53e3\u65f6\u9ed8\u8ba4\u4f7f\u7528\u7684\u4e0d\u662f3306\u7aef\u53e3\u3002\u9700\u8981\u6307\u5b9a\u4f7f\u7528\u4e0e\u6620\u5c04\u7684\u7aef\u53e3\u76f8\u5bf9\u5e94\u7684\u7aef\u53e3\u53f7\u8fdb\u884c\u8fde\u63a5\u3002 \u8981\u4ece\u672c\u5730\u8bbf\u95eedocker\u4e2d\u7684mysql\uff0c\u7aef\u53e3\u6620\u5c04\u5982\u4e0b\uff1a -p 33060:3306 \u767b\u5f55\u540e\u590d\u5236 \u8fd9\u610f\u5473\u7740\u5bb9\u5668\u5185\u76843306\u7aef\u53e3\u5c06\u6620\u5c04\u5230\u672c\u5730\u768433060\u7aef\u53e3\u3002\u56e0\u6b64\uff0c\u8fde\u63a5\u65f6\u5e94\u4f7f\u7528\u7aef\u53e333060\uff1a mysql -p 33060 -u root -p \u767b\u5f55\u540e\u590d\u5236 \u53e6\u5916\uff0c\u8fd8\u9700\u8981\u786e\u4fdd\u5bb9\u5668\u5185\u7684mysql\u7528\u6237\u88ab\u8bbe\u7f6e\u4e3a\u5141\u8bb8\u8fdc\u7a0b\u8fde\u63a5\u3002\u4e3a\u6b64\uff0c\u53ef\u4ee5\u5c06host\u8bbe\u7f6e\u4e3a%\uff1a GRANT ALL PRIVILEGES ON *.* TO &#8216;root&#8217;@&#8217;%&#8217; IDENTIFIED BY &#8216;password&#8217;; FLUSH PRIVILEGES; \u767b\u5f55\u540e\u590d\u5236 \u4ee5\u4e0a\u5c31\u662fDocker\u5b89\u88c5MySQL\u540e\uff0c\u672c\u5730\u65e0\u6cd5\u8fde\u63a5\u600e\u4e48\u529e\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-7538","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7538","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=7538"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7538\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=7538"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=7538"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=7538"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}