{"id":1725,"date":"2023-03-26T19:48:52","date_gmt":"2023-03-26T11:48:52","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1725"},"modified":"2023-04-23T21:35:12","modified_gmt":"2023-04-23T13:35:12","slug":"mysql-8-winx64-cluster-under-windows-master-slave-configuration","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/26\/mysql-8-winx64-cluster-under-windows-master-slave-configuration\/","title":{"rendered":"Windows\u4e0b mysql-8.x-winx64 \u96c6\u7fa4-\u4e3b\u4ece\u914d\u7f6e"},"content":{"rendered":"<h2>\u4e3b\uff1a192.168.1.20<\/h2>\n<h3>\u4e3b\u8282\u70b9\u5728 my.ini \u6587\u4ef6\u65b0\u589e\u914d\u7f6e<\/h3>\n<pre><code class=\"language-bash\">server-id=1\nlog-bin=mysql-bin<\/code><\/pre>\n<p><!-- more --><\/p>\n<h3>\u91cd\u542f\u670d\u52a1<\/h3>\n<pre><code class=\"language-bash\">net stop mysql\nnet start mysql<\/code><\/pre>\n<h3>\u4e3a\u4ece\u8282\u70b9\u521b\u5efa\u8d26\u53f7\u540c\u6b65\u8d26\u53f7\uff0c\u6388\u6743<\/h3>\n<pre><code class=\"language-sql\">CREATE USER &#039;slave&#039;@&#039;%&#039; IDENTIFIED BY &#039;appblog.cn&#039;;\nGRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO &#039;slave&#039;@&#039;%&#039;;\n-- GRANT ALL PRIVILEGES ON *.* TO &#039;slave&#039;@&#039;%&#039;;\nflush privileges; <\/code><\/pre>\n<h3>\u67e5\u770b\u4e3b\u8282\u70b9\u72b6\u6001<\/h3>\n<pre><code class=\"language-sql\">show master status;<\/code><\/pre>\n<h2>\u4ece\uff1a192.168.1.21<\/h2>\n<h3>my.ini \u914d\u7f6e\u4e2d\u65b0\u589e\u914d\u7f6e<\/h3>\n<pre><code class=\"language-bash\">server-id=2\nlog-bin=mysql-slave-bin\nrelay_log=edu-mysql-relay-bin<\/code><\/pre>\n<h3>\u91cd\u542f mysql \u670d\u52a1<\/h3>\n<h3>\u914d\u7f6e\u4ece\u8282\u70b9\uff0c\u4ece\u4e3b\u540c\u6b65\u6570\u636e<\/h3>\n<pre><code class=\"language-sql\">change master to master_host=&#039;192.168.1.20&#039;, master_user=&#039;slave&#039;, master_password=&#039;appblog.cn&#039;, master_port=3306, master_log_file=&#039;mysql-bin.000001&#039;, master_log_pos=0, master_connect_retry=30;<\/code><\/pre>\n<h3>\u5f00\u542f slave<\/h3>\n<pre><code class=\"language-sql\">start slave;<\/code><\/pre>\n<h3>\u67e5\u770b\u4ece\u8282\u70b9\u72b6\u6001<\/h3>\n<pre><code class=\"language-sql\">show slave status;<\/code><\/pre>\n<p>\u82e5\u770b\u5230\uff1a<\/p>\n<pre><code class=\"language-sql\">Slave_IO_State: Waiting for master\nMaster_Host: 192.168.1.20\n...\nSlave_IO_Running: Yes\nSlave_SQL_Running: Yes\nReplicate_Do_DB: appblog<\/code><\/pre>\n<p>\u5219\u8bf4\u660e\u4ece\u5e93\u5df2\u4ece\u4e3b\u5e93\uff0c\u540c\u6b65\u51fa appblog \u6570\u636e\u5e93\uff0c\u5e93\u4e2d\u7684\u8868\u53ca\u8868\u4e2d\u5185\u5bb9\u5df2\u81ea\u52a8\u540c\u6b65\u5b8c\u6210<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e3b\uff1a192.168.1.20 \u4e3b\u8282\u70b9\u5728 my.ini \u6587\u4ef6\u65b0\u589e\u914d\u7f6e server-id=1 log-bin=m [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-1725","post","type-post","status-publish","format-standard","hentry","category-mysql"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1725","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=1725"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1725\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1725"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1725"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1725"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}