{"id":200890,"date":"2025-05-06T14:58:50","date_gmt":"2025-05-06T06:58:50","guid":{"rendered":"https:\/\/server.hk\/cnblog\/200890\/"},"modified":"2025-05-06T14:58:50","modified_gmt":"2025-05-06T06:58:50","slug":"docker-%e4%b8%ad-mysql-%e6%97%a0%e6%b3%95%e4%bb%8e%e6%9c%ac%e5%9c%b0%e8%bf%9e%e6%8e%a5%ef%bc%9a%e7%ab%af%e5%8f%a3%e8%a2%ab%e5%8d%a0%e7%94%a8%e6%80%8e%e4%b9%88%e5%8a%9e%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/200890\/","title":{"rendered":"Docker \u4e2d MySQL \u65e0\u6cd5\u4ece\u672c\u5730\u8fde\u63a5\uff1a\u7aef\u53e3\u88ab\u5360\u7528\u600e\u4e48\u529e\uff1f"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>Docker \u4e2d MySQL \u65e0\u6cd5\u4ece\u672c\u5730\u8fde\u63a5\uff1a\u7aef\u53e3\u88ab\u5360\u7528\u600e\u4e48\u529e\uff1f<\/h1>\n<p>\u600e\u4e48\u5165\u95e8\u6570\u636e\u5e93\u7f16\u7a0b\uff1f\u9700\u8981\u5b66\u4e60\u54ea\u4e9b\u77e5\u8bc6\u70b9\uff1f\u8fd9\u662f\u65b0\u624b\u4eec\u521a\u63a5\u89e6\u7f16\u7a0b\u65f6\u5e38\u89c1\u7684\u95ee\u9898\uff1b\u4e0b\u9762\u4e3b\u673a\u5b9d\u8d1d\u5c31\u6765\u7ed9\u5927\u5bb6\u6574\u7406\u5206\u4eab\u4e00\u4e9b\u77e5\u8bc6\u70b9\uff0c\u5e0c\u671b\u80fd\u591f\u7ed9\u521d\u5b66\u8005\u4e00\u4e9b\u5e2e\u52a9\u3002\u672c\u7bc7\u6587\u7ae0\u5c31\u6765\u4ecb\u7ecd\u300aDocker \u4e2d MySQL \u65e0\u6cd5\u4ece\u672c\u5730\u8fde\u63a5\uff1a\u7aef\u53e3\u88ab\u5360\u7528\u600e\u4e48\u529e\uff1f\u300b\uff0c\u6d89\u53ca\u5230\uff0c\u6709\u9700\u8981\u7684\u53ef\u4ee5\u6536\u85cf\u4e00\u4e0b<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241119\/1731994434673c2342e26a1.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>docker \u4e2d mysql \u65e0\u6cd5\u4ece\u672c\u5730\u8fde\u63a5<\/strong><\/p>\n<p>\u4f60\u9047\u5230\u4e86\u5728 docker \u5bb9\u5668\u4e2d\u8fd0\u884c mysql \u955c\u50cf\u540e\u65e0\u6cd5\u4ece\u672c\u5730\u8fde\u63a5\u7684\u95ee\u9898\u3002\u65e5\u5fd7\u663e\u793a mysql \u5df2\u7ecf\u5728\u76d1\u542c 3306 \u7aef\u53e3\u3002<\/p>\n<p><strong>\u539f\u56e0\u5206\u6790<\/strong><\/p>\n<p>\u4f60\u63d0\u5230\u7684\u539f\u56e0\u53ef\u80fd\u662f\u6b63\u786e\u7684\uff0c\u5373\u672c\u673a\u4e0a\u7684 mysql \u8fdb\u7a0b\u6b63\u5728\u5360\u7528 3306 \u7aef\u53e3\uff0c\u4ece\u800c\u5bfc\u81f4 docker \u5bb9\u5668\u4e2d\u7684 mysql \u65e0\u6cd5\u5728\u8be5\u7aef\u53e3\u4e0a\u7ed1\u5b9a\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848<\/strong><\/p>\n<p>\u8981\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u4f60\u53ef\u4ee5\u6267\u884c\u4ee5\u4e0b\u64cd\u4f5c\uff1a<\/p>\n<ul>\n<li><strong>\u4fee\u6539 docker \u914d\u7f6e\uff1a<\/strong>\u5c06 docker \u5bb9\u5668\u4e2d\u7684 mysql \u7ed1\u5b9a\u5230\u4e00\u4e2a\u4e0d\u540c\u7684\u7aef\u53e3\u3002\u4f8b\u5982\uff0c\u5c06 -p 3306 \u53c2\u6570\u4fee\u6539\u4e3a -p 33060\u3002<\/li>\n<li><strong>\u5378\u8f7d\u672c\u5730 mysql\uff1a<\/strong>\u5982\u679c\u4f60\u4e0d\u518d\u9700\u8981\u672c\u673a\u4e0a\u7684 mysql\uff0c\u53ef\u4ee5\u5378\u8f7d\u5b83\u4ee5\u91ca\u653e 3306 \u7aef\u53e3\u3002<\/li>\n<li><strong>\u914d\u7f6e\u8fdc\u7a0b\u8fde\u63a5\uff1a<\/strong>\u5373\u4f7f\u5378\u8f7d\u4e86\u672c\u5730 mysql\uff0c\u4e5f\u53ef\u4ee5\u4e3a docker \u5bb9\u5668\u4e2d\u7684 mysql \u542f\u7528\u8fdc\u7a0b\u8fde\u63a5\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5c06 mysql \u7528\u6237\u8bbe\u7f6e\u4e3a\u5141\u8bb8\u8fdc\u7a0b\u8fde\u63a5\uff1a<\/li>\n<\/ul>\n<pre>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'your_password';\nFLUSH PRIVILEGES;<\/pre>\n<p>\u672c\u7bc7\u5173\u4e8e\u300aDocker \u4e2d MySQL \u65e0\u6cd5\u4ece\u672c\u5730\u8fde\u63a5\uff1a\u7aef\u53e3\u88ab\u5360\u7528\u600e\u4e48\u529e\uff1f\u300b\u7684\u4ecb\u7ecd\u5c31\u5230\u6b64\u7ed3\u675f\u5566\uff0c\u4f46\u662f\u5b66\u65e0\u6b62\u5883\uff0c\u60f3\u8981\u4e86\u89e3\u5b66\u4e60\u66f4\u591a\u5173\u4e8e\u6570\u636e\u5e93\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u8bf7\u5173\u6ce8\u4e3b\u673a\u5b9d\u8d1d\u516c\u4f17\u53f7\uff01<\/p>\n<dl>\n<dt>\n <\/dt>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>Docker \u4e2d MySQL \u65e0&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-200890","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200890","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=200890"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200890\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=200890"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=200890"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=200890"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}