{"id":1466,"date":"2023-03-24T22:12:28","date_gmt":"2023-03-24T14:12:28","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1466"},"modified":"2023-04-28T20:36:09","modified_gmt":"2023-04-28T12:36:09","slug":"nacos-deployment-using-mysql","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/24\/nacos-deployment-using-mysql\/","title":{"rendered":"Nacos\u90e8\u7f72\u4f7f\u7528MySQL"},"content":{"rendered":"<h2>\u5355\u673a\u6a21\u5f0f\u652f\u6301MySQL<\/h2>\n<p>\u6211\u4eec\u6ca1\u6709\u5bf9 Nacos Server \u505a\u4efb\u4f55\u914d\u7f6e\uff0c\u90a3\u4e48\u914d\u7f6e\u4fe1\u606f\u6570\u636e\u53ea\u6709\u4e24\u4e2a\u4f4d\u7f6e\u53ef\u4ee5\u5b58\u50a8\uff1a\u5185\u5b58\u548c\u672c\u5730\u6570\u636e\u5e93\u3002\u5982\u679c\u91cd\u542f\u6b63\u5728\u8fd0\u884c\u7684 Nacos Server\uff0c\u4f1a\u53d1\u73b0\u914d\u7f6e\u4fe1\u606f\u8fd8\u5728\uff0c\u8bf4\u660e\u4e0d\u662f\u5185\u5b58\u5b58\u50a8\u7684\u3002<\/p>\n<p>\u6253\u5f00<code>NACOS_PATH\/data<\/code>\uff0c\u4f1a\u53d1\u73b0\u91cc\u8fb9\u6709\u4e2a<code>derby-data<\/code>\u76ee\u5f55\uff0c<code>Derby<\/code>\u662f Java \u7f16\u5199\u7684\u6570\u636e\u5e93\uff0c\u5c5e\u4e8e Apache \u7684\u4e00\u4e2a\u5f00\u6e90\u9879\u76ee\u3002Nacos\u7684\u914d\u7f6e\u6570\u636e\u73b0\u5728\u5c31\u5b58\u50a8\u5728\u8fd9\u4e2a\u6570\u636e\u5e93\u4e2d\u3002<\/p>\n<p><!-- more --><\/p>\n<p>Nacos\u5355\u673a\u6a21\u5f0f\u9ed8\u8ba4\u4f7f\u7528\u5185\u5d4c\u7684\u6570\u636e\u5e93<code>Derby<\/code>\u4f5c\u4e3a\u5b58\u50a8\u5f15\u64ce\uff0c\u5982\u679c\u60f3\u6362\u6210\u81ea\u5df1\u5b89\u88c5\u7684MySQL\uff0c\u53ef\u4ee5\u53c2\u7167\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/nacos.io\/zh-cn\/docs\/deployment.html\">https:\/\/nacos.io\/zh-cn\/docs\/deployment.html<\/a><\/p>\n<p>\u57280.7\u7248\u672c\u4e4b\u524d\uff0c\u5728\u5355\u673a\u6a21\u5f0f\u65f6nacos\u4f7f\u7528\u5d4c\u5165\u5f0f\u6570\u636e\u5e93\u5b9e\u73b0\u6570\u636e\u7684\u5b58\u50a8\uff0c\u4e0d\u65b9\u4fbf\u89c2\u5bdf\u6570\u636e\u5b58\u50a8\u7684\u57fa\u672c\u60c5\u51b5\u30020.7\u7248\u672c\u589e\u52a0\u4e86\u652f\u6301MySQL\u6570\u636e\u6e90\u80fd\u529b\uff0c\u5177\u4f53\u7684\u64cd\u4f5c\u6b65\u9aa4\uff1a<\/p>\n<p>\uff081\uff09\u5b89\u88c5\u6570\u636e\u5e93\uff0c\u7248\u672c\u8981\u6c42\uff1a5.6.5+<br \/>\n\uff082\uff09\u521d\u59cb\u5316mysql\u6570\u636e\u5e93\uff0c\u6570\u636e\u5e93\u521d\u59cb\u5316\u6587\u4ef6\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/github.com\/alibaba\/nacos\/blob\/master\/distribution\/conf\/nacos-mysql.sql\" title=\"nacos-mysql.sql\">nacos-mysql.sql<\/a><br \/>\n\uff083\uff09\u4fee\u6539<code>conf\/application.properties<\/code>\u6587\u4ef6\uff0c\u589e\u52a0\u652f\u6301MySQL\u6570\u636e\u6e90\u914d\u7f6e\uff08\u76ee\u524d\u53ea\u652f\u6301MySQL\uff09\uff0c\u6dfb\u52a0MySQL\u6570\u636e\u6e90\u7684url\u3001\u7528\u6237\u540d\u548c\u5bc6\u7801\u3002<\/p>\n<blockquote>\n<p>\u6ce8\u610f\uff1a\u6682\u4e0d\u652f\u6301 MySQL 8.0 \u7248\u672c<\/p>\n<\/blockquote>\n<pre><code>spring.datasource.platform=mysql\n\ndb.num=1\ndb.url.0=jdbc:mysql:\/\/192.168.196.16:3306\/nacos?characterEncoding=utf8&amp;connectTimeout=1000&amp;socketTimeout=3000&amp;autoReconnect=true\ndb.user=nacos\ndb.password=youdontknow<\/code><\/pre>\n<p>\u518d\u4ee5\u5355\u673a\u6a21\u5f0f\u542f\u52a8nacos\uff0cnacos\u6240\u6709\u5199\u5d4c\u5165\u5f0f\u6570\u636e\u5e93\u7684\u6570\u636e\u90fd\u4f1a\u5199\u5230MySQL<\/p>\n<pre><code>sh startup.sh -m standalone<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5355\u673a\u6a21\u5f0f\u652f\u6301MySQL \u6211\u4eec\u6ca1\u6709\u5bf9 Nacos Server \u505a\u4efb\u4f55\u914d\u7f6e\uff0c\u90a3\u4e48\u914d\u7f6e\u4fe1\u606f\u6570\u636e\u53ea\u6709\u4e24\u4e2a\u4f4d\u7f6e\u53ef\u4ee5\u5b58\u50a8 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-1466","post","type-post","status-publish","format-standard","hentry","category-nacos"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1466","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1466"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1466\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1466"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1466"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1466"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}