Mysql主从复制
来源:互联网 发布:苹果电脑mac使用技巧 编辑:程序博客网 时间:2024/06/06 01:22
1
2
3
4
5
6
7
8
9
10
11
12
13
master服务器配置:
vi
/usr/local/mysql/etc/my
.cnf
[mysqld]
server-
id
=202
#设置服务器唯一的id,默认是1,我们设置ip最后一段,slave设置203
log-bin=mysql-bin
# 启用二进制日志
#binlog-ignore-db = mysql,information_schema #忽略写入binlog的库
slave服务器配置:
vi
/usr/local/mysql/etc/my
.cnf
[mysqld]
server-
id
=203
replicate-
do
-db = abc
#只同步abc库
slave-skip-errors = all
#忽略因复制出现的所有错误
1
/etc/init
.d
/mysqld
restart
1
2
mysql> mysql -u root -p123.com
mysql> GRANT REPLICATION SLAVE ON *.* to ‘
sync
’@‘192.168.1.2’ identified by ‘1234.com’;
#replication:复制
1
2
3
4
5
6
mysql> show master status;
+------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000002 | 263 | | |
+------------------+----------+--------------+------------------+
1
2
3
4
5
6
7
mysql> change master to
-> master_host=
'192.168.0.202'
,
-> master_user=
'sync'
,
-> master_password=
'1234.com'
,
-> master_log_file=
'mysql-bin.000002'
,
-> master_log_pos=
263
;
#Log和pos是master上随机获取的。这段也可以写到my.cnf里面。
1
mysql> start slave;
1
2
3
4
5
6
7
8
9
10
11
mysql> create database abc;
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| abc |
| mysql |
| performance_schema |
|
test
|
+--------------------+
0 0
- 【mysql 主从复制】掌握MySQL主从复制
- mysql 主从复制 主从配置
- MySQL主从复制配置
- mysql主从数据复制
- Mysql 主从复制
- mysql的主从复制
- Mysql搭建主从复制
- MySQL主从复制配置
- Mysql 主从数据库复制
- mysql主从复制
- MySQL主从复制
- mysql主从复制
- 配置MySQL主从复制
- Mysql的主从复制
- MySQL主从复制
- MySQL主从复制功能
- Linux MySQL主从复制
- MYSQL 主从复制(Replication)
- Linux下jdk的安装
- 史玉柱亲笔写的脑白金策划方案
- C++中传统枚举和强类型枚举的区别?
- iOS 扩展机制category与associative
- 机器学习系列(4)_机器学习算法一览,应用建议与解决思路
- Mysql主从复制
- StateListDrawable资源
- Android APK反编译获取资源
- 集团性企业数据信息系统解决方案
- C语言BT软件项目总结
- CPC客户端报错 error
- Python之数据规整化:清理、转换、合并、重塑
- Spring MVC 学习笔记(一)
- Selenium+Python 鼠标事件