MySQL master/slave
Master my.ini
Slave my.ini
Master 執行
mysql> CREATE USER 'rep'@'%' IDENTIFIED BY 'rep';
mysql> GRANT FILE ON *.* TO 'rep'@'%' IDENTIFIED BY 'rep';
mysql> GRANT REPLICATION SLAVE ON *.* TO 'rep'@'%' IDENTIFIED BY 'rep';
mysql> FLUSH PRIVILEGES;
mysql> show master status;
+------------------+----------+--------------+----------------------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+----------------------------------+-------------------+
| mysql-bin.000002 | 4570 | test | information_schema,cluster,mysql | |
+------------------+----------+--------------+----------------------------------+-------------------+
Slave 執行
mysql> CREATE USER 'rep'@'%' IDENTIFIED BY 'rep';
mysql> change master to master_host='localhost',master_user='rep',master_password='rep',master_log_file='mysql-bin.000002', master_log_pos=4570;
mysql> start slave;
mysql> show slave status;
Slave_IO_Running 和 Slave_SQL_Running都是 Yes 表示成功。
Master建立資料庫,建立表,新增資料,會自動複製到Slave。
-
basedir = D:\mysql_test\mysql-5.7.17-master
-
datadir = D:\mysql_test\mysql-5.7.17-master\data
-
port = 3306
-
log-bin=mysql-bin
-
server_id=1
-
binlog-ignore-db=information_schema
-
binlog-ignore-db=cluster
-
binlog-ignore-db=mysql
- binlog-do-db=test
-
basedir = D:\mysql_test\mysql-5.7.17-slave
-
datadir = D:\mysql_test\mysql-5.7.17-slave\data
-
port = 3307
-
log-bin=mysql-bin
-
server-id=2
-
binlog-ignore-db=information_schema
-
binlog-ignore-db=cluster
-
binlog-ignore-db=mysql
-
replicate-do-db=test
-
replicate-ignore-db=mysql
-
log-slave-updates
-
slave-skip-errors=all
- slave-net-timeout=60
mysql> CREATE USER 'rep'@'%' IDENTIFIED BY 'rep';
mysql> GRANT FILE ON *.* TO 'rep'@'%' IDENTIFIED BY 'rep';
mysql> GRANT REPLICATION SLAVE ON *.* TO 'rep'@'%' IDENTIFIED BY 'rep';
mysql> FLUSH PRIVILEGES;
mysql> show master status;
+------------------+----------+--------------+----------------------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+----------------------------------+-------------------+
| mysql-bin.000002 | 4570 | test | information_schema,cluster,mysql | |
+------------------+----------+--------------+----------------------------------+-------------------+
Slave 執行
mysql> CREATE USER 'rep'@'%' IDENTIFIED BY 'rep';
mysql> change master to master_host='localhost',master_user='rep',master_password='rep',master_log_file='mysql-bin.000002', master_log_pos=4570;
mysql> show slave status;
Slave_IO_Running 和 Slave_SQL_Running都是 Yes 表示成功。
Master建立資料庫,建立表,新增資料,會自動複製到Slave。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10742815/viewspace-2131666/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL Master/Slave Master/MasterMySqlAST
- MySql的Master/SlaveMySqlAST
- mysql master和slave配置MySqlAST
- mysql slave 轉為 masterMySqlAST
- MySQL 5.5 Master/Slave 配置MySqlAST
- mysql master slave 主從同步MySqlAST主從同步
- mysql 同步 master-slave薦MySqlAST
- Mysql Slave群切換MasterMySqlAST
- Mysql Slave群切換Master (=)MySqlAST
- MySQL master and slave have equal MySQL server UUIDsMySqlASTServerUI
- MySQL錯誤之mysql.slave_master_infoMySqlAST
- mysql建立master/slave詳細步驟MySqlAST
- 利用mysql slave 修復master MyISAM tableMySqlAST
- Redis master and slaveRedisAST
- Mysql 5.6 Master和Slave 主備切換MySqlAST
- MYSQL的master/slave資料同步配置(轉)MySqlAST
- The slave I/O thread stops because master and slave have equal MySQL server UUIDthreadASTMySqlServerUI
- Mysql Master-slave複製簡單配置記錄MySqlAST
- mysql master-slave複製錯誤[解決事例]MySqlAST
- MYSQL5的master slave資料同步配置(轉)MySqlAST
- mysql slave 跟進 master 的關鍵狀態指標MySqlAST指標
- Mysqldump實現mysql的master-slave主從複製MySqlAST
- master and slave have equal MySQL server UUIDs問題解決ASTMySqlServerUI
- MySQL 5.5.x 配置Master-Slave主從複製MySqlAST
- Mongodb的master-slave模式與master-master模式實驗MongoDBAST模式
- Innobackupex實現mysql線上搭建master-slave主從複製MySqlAST
- MySQL報錯Slave: received end packet from server, apparent master shutdownMySqlServerAPPAST
- Linux環境下MySQL5.6Master-Slave配置實戰LinuxMySqlAST
- Jenkins : 安裝 master 和 slaveJenkinsAST
- 用mysqldump --master-data 建立slaveMySqlAST
- MYSQL5.7 MASTER-SLAVE 線上關閉和啟動GTIDMySqlAST
- mysql5.6,master/slave架構,master,不寫bingo原因,無法開啟同步複製MySqlAST架構Go
- slave之Seconds_Behind_Master析AST
- 【Mysql】Slave_IO_Running: No---Got fatal error 1236 from masterMySqlGoErrorAST
- 故障案例:主從同步報錯Fatal error: The slave I/O thread stops because master and slave have equal MySQL server主從同步ErrorthreadASTMySqlServer
- Setup MariaDB Master/Slave Replication for Docker MariaDBASTDocker
- MySQL新建SlaveMySql
- 資料庫讀寫分離Master-Slave資料庫AST