2012-02-20 90 views
0

我想在我的wamp服務器上使用主從複製複製我的數據庫。我做了我的my.ini文件進行以下更改:定時數據庫複製使用Wamp服務器mysql進行主 - 從複製

# Number of threads allowed inside the InnoDB kernel.The optimal value 
# depends highly on the application, hardware as well as the OS 
# scheduler properties. A too high value may lead to thread thrashing. 
innodb_thread_concurrency=8 

#Defining the directory for logs and database and the server id 
log-bin=C:\wamp\logs\mysql-bin.log 
binlog-do-db=bank 
server-id=2 

在主服務器我配置了這一點:

mysql> GRANT REPLICATION SLAVE 
-> ON *.* TO 'root'@'slave_ip' 
-> IDENTIFIED BY ''; 

在從服務器,我配置此:

mysql> CHANGE MASTER TO 
-> MASTER_HOST='(master_ip)', 
-> MASTER_PORT=3306, 
-> MASTER_USER='root', 
-> MASTER_PASSWORD=''; 

我得到錯誤:錯誤1198:此操作不能用正在運行的從站執行;首先運行停止從站。

所以我跑停止奴隸,什麼都沒有發生。任何幫助,將不勝感激。

回答

0

上主:

SHOW MASTER STATUS;

輸出是:

+------------------+----------+--------------+------------------+ 
| File    | Position | Binlog_Do_DB | Binlog_Ignore_DB | 
+------------------+----------+--------------+------------------+ 
| mysql-bin.000001 |  107 | karbord_test |     | 
+------------------+----------+--------------+------------------+ 
1 row in set 

上從站:

STOP SLAVE; 

CHANGE MASTER TO 
MASTER_LOG_FILE='mysql-bin.000001', 
MASTER_LOG_POS=107; 

START SLAVE;