• ADADADADAD

    说说MySQL 主从复制吧[ mysql数据库 ]

    mysql数据库 时间:2024-12-24 19:10:56

    作者:文/会员上传

    简介:

    环境:win10(就配置主从来说linux和windows差别不大),MySQL-5.7.16
    1.首先要两个MySQL实例,我这里分别是3307,3308,其中3307作为master,3308作为slave
    2.修改master实例的配置my.ini,

    以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。


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


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


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

    Ini代码

      [mysqld]log_bin=mysql-binserver_id=3307#server_id随意但必须唯一


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

    Ini代码

      [mysqld]log_bin=mysql-binserver_id=3308#server_id随意但必须唯一


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


    授权后执行flush privileges; 我这里忘记截了.

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



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


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


    7.查看slave status:



    其中Slave_IORunning和Slave_SQL_Running均为YES才说明成功.

    这里就算配置完成了。


    测试

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


    在slave 上select数据:现货重油


      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 主从复制吧.docx

    将本文的Word文档下载到电脑

    推荐度:

    下载
    热门标签: mysql主从复制