新网创想网站建设,新征程启航

为企业提供网站建设、域名注册、服务器等服务

说说MySQL主从复制吧-创新互联


环境:win10(就配置主从来说linux和windows差别不大),MySQL-5.7.16

创新互联是工信部颁发资质IDC服务器商,为用户提供优质的雅安电信机房服务

1.首先要两个MySQL实例,我这里分别是3307,3308,其中3307作为master,3308作为slave

2.修改master实例的配置my.ini,增加两行:

Ini代码 

 说说MySQL 主从复制吧

  1. [mysqld]  
  2. log_bin = mysql-bin  
  3. server_id = 3307    #server_id 随意但必须唯一  

3.修改slave实例的配置my.ini,增加两行:

Ini代码 

 说说MySQL 主从复制吧

  1. [mysqld]  
  2. log_bin = mysql-bin  
  3. server_id = 3308    #server_id 随意但必须唯一  

 4.启动master,登陆后,创建用户replicant,并授权

说说MySQL 主从复制吧
 授权后执行flush privileges; 我这里忘记截了.

5.查看master状态,前两项要记住:

说说MySQL 主从复制吧

 到这里master就完了,在配置完slave之前最好就不要在动master,因为有可能会改变Position。

6.启动slave,登陆后,执行:

说说MySQL 主从复制吧
 

7.查看slave status:

说说MySQL 主从复制吧
 其中Slave_IORunning和Slave_SQL_Running均为YES才说明成功.

这里就算配置完成了。

测试

在master上新建库,表,插入数据:

说说MySQL 主从复制吧

在slave 上select数据:现货重油

说说MySQL 主从复制吧

  http://www.wangchao.net.cn/hi/detail_232429.html

  http://www.wangchao.net.cn/hi/detail_232433.html

  http://www.wangchao.net.cn/hi/detail_232437.html

  http://www.wangchao.net.cn/hi/detail_232438.html

  http://www.wangchao.net.cn/hi/detail_232441.html

  http://www.365128.com/user/myx2/39.html

  http://www.365128.com/user/myx2/40.html

  http://www.365128.com/user/myx2/41.html

  http://www.365128.com/user/myx2/42.html

  http://www.365128.com/user/myx2/43.html

  http://www.365128.com/user/myx2/44.html

  http://www.365128.com/user/myx2/45.html

  http://www.365128.com/user/myx2/46.html

  http://www.365128.com/user/myx2/47.html

  http://www.365128.com/user/myx2/48.html

  http://site.leshou.com/s/33563826.html

  http://site.leshou.com/s/33563870.html

  http://site.leshou.com/s/33563896.html

  http://site.leshou.com/s/33563950.html

  http://site.leshou.com/s/33564004.html

  http://site.leshou.com/s/33564069.html

  http://site.leshou.com/s/33564112.html

  http://site.leshou.com/s/33564134.html

  http://site.leshou.com/s/33564165.html

  http://site.leshou.com/s/33564197.html


当前题目:说说MySQL主从复制吧-创新互联
URL网址:http://www.wjwzjz.com/article/dpepdi.html
在线咨询
服务热线
服务热线:028-86922220
TOP