2012-02-20 95 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;