当前位置:Gxlcms > 数据库问题 > mysql主从库同步读写分离搭建

mysql主从库同步读写分离搭建

时间:2021-07-01 10:21:17 帮助过:5人阅读

alter user ‘test‘@‘localhost‘ identified by ‘test‘ password expire never;

      alter user ‘test‘@‘localhost‘ identified with mysql_native_password by ‘test‘;

      flush privileges;

      8、查看主库信息

        show master status; 记录下file和position信息(log.000003和448)。

      9、配置从库信息

        登录从库:mysql -P3321 -uroot -proot

        配置从库的mster:   change master to master_host=‘127.0.0.1‘,master_port=3320,master_user=‘test‘,master_password=‘test‘,master_log_file=‘log.000003‘,master_log_pos=448;

      10、从库开启数据库复制功能

        start slave;

      11、查看从库信息

        show slave status \G(不需要;分号结尾)

        技术图片

  五、以上操作执行完就可以测试了,navicat登陆主从库,在主库中新建数据库,表,数据,从库同时会出现。(其他工具测试应该也没问题) 

   六、遇到问题解决方案

    1、slave_io_running connecting  问题

      参考:https://blog.csdn.net/mbytes/article/details/86711508

    1、计算机丢失vcruntime140_1.dll

      参考: https://blog.csdn.net/mr__sun__/article/details/104669448

    2、navicat 登录不上 报1251  解决办法: cmd 管理员运行,cd到mysqlbin路径下执行以下命令

    mysql -P3320 -uroot -proot

    alter user ‘root‘@‘localhost‘ identified by ‘root‘ password expire never;

    alter user ‘root‘@‘localhost‘ identified with mysql_native_password by ‘root‘;

    flush privileges;

技术图片

 

mysql主从库同步读写分离搭建

标签:style   net   l数据库   令行   客户端   sla   tin   ora   mysql主从   

人气教程排行