使用 Wamp Server mysql 进行定时数据库复制进行主从复制

发布于 2025-01-06 20:06:55 字数 875 浏览 5 评论 0原文

我正在尝试在 wamp 服务器上使用主从复制来复制我的数据库。我对 my.ini 文件进行了以下更改:

# 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:无法对正在运行的从服务器执行此操作;首先运行停止从站。

所以我跑了 stop Slave 并没有发生任何事情。任何帮助将不胜感激。

I am trying to replicate my database using master slave replication on my wamp server. I have made the following changes to my my.ini file:

# 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

On Master Server I configured this:

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

On the slave server, I configured this:

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

I got the error: Error 1198: This operation cannot be performed with a running slave; run stop slave first.

So I ran stop slave and nothing happened. Any help would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

后eg是否自 2025-01-13 20:06:55

在主设备上:

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;

on master:

SHOW MASTER STATUS;

output is :

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

on slave:

STOP SLAVE;

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

START SLAVE;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文