| mysql-bin.000001 | 120 | | | |
+------------------+----------+--------------+------------------+-------------------+
4 配置从服务器:
vim /etc/my.cnf
character_set_server = utf8
max_connections = 3000
skip-name-resolve
slow_query_log = TRUE
slow_query_log_file = /home/db/slow.log
long_query_time = 5
log-bin = mysql-bin
binlog_format = ROW
innodb_file_per_table = OFF
open_files_limit = 65535
back_log = 600
max_connect_errors = 6000
server_id = 2
sql_mode = NO_ENGINE_SUBSTITUTION
auto_increment_increment = 2
auto_increment_offset = 2
replicate-do-db = test1 要接收的库
# /etc/init.d/mysql restart
Shutting down MySQL.. SUCCESS!
Starting MySQL..^[[A. SUCCESS!
# mysql -uroot -p123456
change master to master_host='192.168.1.28',master_user='root',master_password='abc-123',master_log_file='mysql-bin.000001', master_log_pos=120;
mysql> start slave; #开启Slave
mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.1.28
Master_User: hm
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000004
Read_Master_Log_Pos: 120
Relay_Log_File: localhost-relay-bin.000013
Relay_Log_Pos: 283
Relay_Master_Log_File: mysql-bin.000004
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: students
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 120
Relay_Log_Space: 460
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_UUID: 71a3a3a2-0d99-11e7-b0de-000c290c49b2
Master_Info_File: /mysql/data/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL