Posted in
Hosting & IIS7 |
No Comment | 2,940 views | 03/05/2011 22:10
If you face with a MySQL replication issue, you should restart it with command line.
First of all, stop MySQL services and replicate latest MySQL data files. After that, you can start services again.
Go to Slave and execute:
mysql> STOP SLAVE;
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH TABLES WITH READ LOCK;
Query OK, 0 rows affected (0.00 sec)
mysql> UNLOCK TABLES;
Query OK, 0 rows affected (0.00 sec)
mysql> CHANGE MASTER TO MASTER_LOG_FILE='mysqld-bin.000001';
Query OK, 0 rows affected (0.00 sec)
mysql> CHANGE MASTER TO MASTER_LOG_POS=98;
Query OK, 0 rows affected (0.00 sec)
mysql> start slave;
Query OK, 0 rows affected (0.00 sec) |
mysql> STOP SLAVE;
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH TABLES WITH READ LOCK;
Query OK, 0 rows affected (0.00 sec)
mysql> UNLOCK TABLES;
Query OK, 0 rows affected (0.00 sec)
mysql> CHANGE MASTER TO MASTER_LOG_FILE='mysqld-bin.000001';
Query OK, 0 rows affected (0.00 sec)
mysql> CHANGE MASTER TO MASTER_LOG_POS=98;
Query OK, 0 rows affected (0.00 sec)
mysql> start slave;
Query OK, 0 rows affected (0.00 sec)
You can get Master_Log_File and Master_Log_Pos with executing “SHOW MASTER STATUS;” on Master MySQL.
If you want to see replication status again, execute:
I don’t know any better way. If you have one, please reply :)