MySql 主从同步 (库名不同)
主库:192.168.1.250
从库:192.168.1.199
主库 my.ini
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
# 以下内容手动添加
[client]
default-character-set=utf8
[mysqld]
port=3306
server-id=1
log-bin=mysql-bin
binlog-do-db=kintech_pd
sync_binlog=1
basedir=C:\ProgramData\MySQL\MySQL Server 5.7
#解压目录下data目录
datadir=C:\ProgramData\MySQL\MySQL Server 5.7\data
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[WinMySQLAdmin]
C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe
从库 my.ini
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
# 以下内容手动添加
[client]
default-character-set=utf8
[mysqld]
#从库配置
server_id=2
#如果库名相同,使用这个
#replicate-do-db=kintech_pd
#如果库名不同,使用这个。
replicate-rewrite-db = kintech_pd -> kps_common
#端口
port=3306
character_set_server=utf8
#解压目录
basedir=C:\ProgramData\MySQL\MySQL Server 5.7
#解压目录下data目录
datadir=C:\ProgramData\MySQL\MySQL Server 5.7\data
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[WinMySQLAdmin]
C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe
主库:记住 File 和 Position
CREATE USER 'slave'@'MySql2服务器ip' IDENTIFIED BY '密码';
GRANT REPLICATION SLAVE ON *.* TO 'slave'@'MySql2服务器ip';
flush privileges;
show master status;
从库:
CHANGE MASTER TO
master_host = 'MySql1服务器ip',
master_user = 'slave',
master_password = '密码',
master_log_file = 'bin_log.000002',
master_log_pos = 631;
start slave;
show slave status\G
最后显示:
代表成功。
MySql 主从同步 (库名不同)的更多相关文章
- windows 系统本地做mysql 主从同步,最后面解决主从同步库名不一致,表结构一致
原文:windows 系统本地做mysql 主从同步,最后面解决主从同步库名不一致,表结构一致 mysql主从同步的好处以及原理 之前看到很多新闻说某某的服务器奔溃,磁盘碎了,导致数据丢失 ...
- mysql 主从同步出问题,重新修复从库 - web架构研究
mysql 主从同步出问题,重新修复从库 - web架构研究 mysql 主从同步出问题,重新修复从库 0 昨天由于操作失误,在从库上执行一堆sql之后,导致主从同步错误,并且已 ...
- Mysql主从同步在线实施步骤【适合大数据库从库配置】
Mysql主从同步在线实施步骤[适合大数据库从库配置] MySQL的主从搭建大家有很多种方式,传统的mysqldump方式是很多人的选择之一,但比较适合在新实例中实施,对于较大的数据库则存在停机等不可 ...
- mysql主从同步+mycat读写分离+.NET程序连接mycat代理
背景 最近新项目需要用到mysql数据库,并且由于数据量大的原因,故打算采用1主1从(主数据库负责增.删.改操作:从数据库负责查操作)的数据库架构,在实现主从之后还要实现读写分离的代理,在网上搜寻了很 ...
- mysql主从同步(3)-percona-toolkit工具(数据一致性监测、延迟监控)使用梳理
转自:http://www.cnblogs.com/kevingrace/p/6261091.html 在mysql工作中接触最多的就是mysql replication mysql在复制方面还是会有 ...
- mysql 主从同步 mysql代理服务器
搭建mysql主从同步(实现数据自动备份)实例:把主机192.168.4.100的数据库配置为主机192.168.4.99的从数据库 主数据库服务器配置修改配置文件: [root@mysql ~]# ...
- Docker Mysql主从同步配置搭建
Docker Mysql主从同步配置搭建 建立目录 在虚拟机中建立目录,例如路径/home/mysql/master/data,目录结构如下: Linux中 新建文件夹命令:mkdir 文件夹名 返回 ...
- Mysql主从同步(1) - 概念和原理介绍 以及 主从/主主模式 部署记录
Mysql复制概念Mysql内建的复制功能是构建大型高性能应用程序的基础, 将Mysql数据分布到多个系统上,这种分布机制是通过将Mysql某一台主机数据复制到其它主机(slaves)上,并重新执行一 ...
- Linux 安装mysql,mariadb,mysql主从同步
myariadb安装 centos7 mariadb的学习 在企业里面,多半不会使用阿里云的mariadb版本,因为版本太低,安全性太低,公司会配置myariadb官方的yum仓库 1.手动创建mar ...
- 【实操笔记】MySQL主从同步功能实现
写在前边: 这两天来了个需求,配置部署两台服务器的MySQL数据同步,折腾了两天查了很多相关资料,一直连不上,后来发现其实是数据库授权的ip有问题,我们用的服务器是机房中的虚拟机加上反向代理出来的,坑 ...
随机推荐
- eclipes个人配置
设置字体:https://jingyan.baidu.com/article/f96699bb9442f3894e3c1b15.html general->appearance->colo ...
- 2017湘潭大学邀请赛G题(贪心+优先队列)
参考博客:http://www.cnblogs.com/chendl111/p/6891770.html 题目链接:https://www.icpc.camp/contests/4mYguiUR8k0 ...
- mysql数据库和JDBC学习
数据库概念: 数据库(Database)是按照数据结构来组织.存储和管理数据的建立在计算机存储设备上的仓库. ---------数据库服务器,mysql(管理) 数据库服务器---->N多库-- ...
- p141一致有界原则
1.Mk取sup 为什么只要取∩就好了 不应该是先并后交吗 2.为什么说是闭集?
- PEP 8 python编程规范
一 代码编排 缩进.4个空格的缩进(编辑器都可以完成此功能),不使用Tap,更不能混合使用Tap和空格. 每行最大长度79,换行可以使用反斜杠,最好使用圆括号.换行点要在操作符的后边敲回车. 类和to ...
- laravel创建项目
composer create-project --prefer-dist laravel/laravel=5.5.* blog
- [转帖]Linux的标准输入 标准输出和错误输出
Linux标准输入.输出和错误和文件重定向 专题 https://www.cnblogs.com/softidea/p/3965093.html 感觉自己对 这一块的理解一直不好 昨天同事给了一个 b ...
- [转帖]50个必知的Linux命令技巧,你都掌握了吗?
50个必知的Linux命令技巧,你都掌握了吗? https://blog.51cto.com/lizhenliang/2131141 https://blog.51cto.com/lizhenlian ...
- RabbitMQ基本操作
更加详细的 链接https://www.cnblogs.com/dwlsxj/p/RabbitMQ.html RabbitMQ基础知识 一.背景 RabbitMQ是一个由erlang开发的AMQP(A ...
- class面向对象-1
一.基本定义 class cl(object): def __init(self,var) self.var=var def func(self,i) print('%s is in %s'%(i,s ...