I want to set up a Master-Slave Replication. Therefore I followed the MySQL manual. Once I was I wanted to test it. I've let me show the slave status with was as following;
Slave_IO_State: Waiting for master to send event Master_Host: xxx.xxx.xxx.xxx Master_User: username Master_Port: 3306 Connect_Retry: 10 Master_Log_File: mysql-bin.000030 Read_Master_Log_Pos: 326 Relay_Log_File: mysql-relay-bin.000002 Relay_Log_Pos: 253 Relay_Master_Log_File: mysql-bin.000029 Slave_IO_Running: Yes Slave_SQL_Running: No Replicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 1051 Last_Error: Error 'Unknown table 'Test'' on query. Default database: 'FOOD'. Query: 'DROP TABLE `Test` /* generated by server */' Skip_Counter: 0 Exec_Master_Log_Pos: 1410 Relay_Log_Space: 2176 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: NULL Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 0 Last_IO_Error: Last_SQL_Errno: 1051 Last_SQL_Error: Error 'Unknown table 'Test'' on query. Default database: 'FOOD'. Query: 'DROP TABLE `Test` /* generated by server */' Replicate_Ignore_Server_Ids: Master_Server_Id: 1
As you can see, the slave was waiting. That's the reason, why I made a test INSERT on the MASTER. As the INSERT did not show on my slave it made me think, that I was missing something while setting it up. Also if I want to uncomment the
bind-address and restart the mysql-service, it fails to start.
Now I'll show you what I have done:
1. Edit my.cnf on Master -> set server-id = 1 set binlog_do_db = database name 2. Restart mysql service on Master 3. Create user for replication: CREATE USER 'slave'@'master IPv4' IDENTIFIED BY 'password'; 4. Grant replication slave: GRANT REPLICATION SLAVE ON *.* TO 'slave'@'%'; 5. Restart mysql service on Master
Now on to the slave:
1. Edit my.cnf on Slave -> set server-id = 2 2. Restart mysql service on Slave 3. Stop slave 4. CHANGE MASTER TO MASTER_HOST='Master IPv4', MASTER_USER='slave', MASTER_PASSWORD='password', MASTER_LOG_FILE='mysql-bin.000029', MASTER_LOG_POS=827; 5. Start slave
After this configuration the slave was showing:
Slave_IO_State: Waiting for master to send event, but id did not receive any changes from the Master. Would be glad if anyone could help me with this.
I use MySQL 5.5.47 and Ubuntu 14.04.1