AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 675112
Accepted
Ernie
Ernie
Asked: 2015-03-13 14:50:56 +0800 CST2015-03-13 14:50:56 +0800 CST 2015-03-13 14:50:56 +0800 CST

在 MySQL 中设置主-主复制时出现语法错误

  • 772

所以我在两个不同的 MySQL 服务器上设置了我的初始主从复制对。那部分工作得很好。所以我所要做的就是将第一个 master 设置为 slave,并将第一个 slave 设置为第二个 master,对吗?

错误的!

这就是我尝试在辅助主服务器上创建第二个从属帐户时发生的情况:

mysql> grant replication slave on *.* to 'repslave2'@'ourhost' identified by 'password';
Query OK, 0 rows affected (0.00 sec)

mysql> start master;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'master' at line 1

什么?你是什​​么意思,“语法错误”?这是很简单的东西。我拼写“主人”是对的。它可以在另一台服务器上运行,而无需安装任何特殊的东西。"stop slave" 和 "start slave" 像在这台服务器上宣传的那样工作。为什么它不起作用?

编辑添加:

我想我已经找到了问题的一部分——主从复制在两台服务器之间混淆了。在这里,我尝试在主主节点上停止主节点:

mysql> stop master;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'master' at line 1
mysql> stop slave;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> stop master;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'master' at line 1
mysql> start master;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'master' at line 1
mysql> start slave;
ERROR 1200 (HY000): The server is not configured as slave; fix in config file or with CHANGE MASTER TO
mysql
  • 3 3 个回答
  • 12671 Views

3 个回答

  • Voted
  1. Best Answer
    Random-IT
    2015-03-13T15:53:23+08:002015-03-13T15:53:23+08:00

    您必须首先在新主服务器上定义主服务器设置,然后在您发送启动主服务器之前停止您希望成为主服务器的服务器上的从服务器;命令。

    可能不是您想要的答案,但它是正确的。

    更好地了解您正在尝试做的事情会有所帮助。

    • 1
  2. fgbreel
    2015-03-13T20:27:17+08:002015-03-13T20:27:17+08:00

    试试start slave。

    每个主服务器应该是另一个主服务器的从服务器,不要忘记server-id在每个服务器上配置不同my.cnf。

    还要正确设置auto_increment_increment并auto_increment_offset避免重复的主键破坏复制。

    在正确配置每台服务器后检查show slave statusifSlave_IO_Running和Slave_SQL_Runningare状态。yes

    • 1
  3. DILDAR
    2016-11-06T07:18:12+08:002016-11-06T07:18:12+08:00

    配置后键入此命令 START SLAVE IO_THREAD

    • 1

相关问题

  • 开源与专有关系 db mgt 系统的优缺点是什么?

  • 在 solaris 10 上为 mysql 设置 max_allowed_pa​​cket

  • 如何移动 MySQL 的数据目录?

  • 通过 VPN 连接什么是远程服务器 IP?

  • mysql崩溃

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve