1

我们有两个 MySQL 数据库设置为主 - 主设置。我们在将数据从 host1 复制到 host2 时遇到问题。我是数据库管理初学者。

错误日志如下

host1:/$ cat /var/log/mysql/error.log
131115 13:51:06 [ERROR] Slave I/O: error reconnecting to master 'host1@host.company.com:3306' - retry-time: 60  retries: 86400, Error_code: 2003

错误不断重复。我已经完成了这个教程http://dev.mysql.com/doc/refman/5.5/en/replication-howto.html和这个http://dev.mysql.com/doc/refman/5.0/en/can -not-connect-to-server.html获取有关 2003 错误代码的帮助。

我从我们的日志中验证了 mysqld 一直在运行,并且 mysql 服务器没有停机。

下面给出了我对成功将数据从 host2 复制到 host1 的 host2 的授权

mysql> show grants;
-------------------------------+
| Grants for admin@localhost                                                                                            |
+--------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' IDENTIFIED BY PASSWORD '*53CB11958EE3FBA4B6C0CECA582369151A97FFA9' |
+-------------------------------------------------------------------------------------------

下面给出了我在 host1 上未成功从 host1 复制到 host2 的授权。

mysql> show grants;
+-------------------------------------------------------------------------------------------
| Grants for admin@localhost                                                                                   |
+-------------------------------------------------------------------------------------------
| GRANT USAGE ON *.* TO 'admin'@'localhost' IDENTIFIED BY PASSWORD '*53CB11958EE3FBA4B6C0CECA582369151A97FFA9' |
| GRANT ALL PRIVILEGES ON `MyDatabase`.* TO 'admin'@'localhost'                                          |
+-------------------------------------------------------------------------------------------

主机状态:host2(正确复制到主机1)

mysql> show master status;
+------------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000235 | 12804977 |              |                  |
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)

主机 1(未正确复制到主机 2)

mysql> show master status;
ERROR 1227 (42000): Access denied; you need (at least one of) the SUPER,REPLICATION CLIENT privilege(s) for this operation

我不太确定我做错了什么。我查看了成功复制到主机的 host2 的 my.cnf 具有以下增量。host1 和 host2 都配置了不同的 server-id参数。两个值都大于 0。

server-id           = 1
replicate-do-db     = MyDatabase
innodb_buffer_pool_size = 2G
innodb_flush_method     = O_DIRECT
read_buffer_size        = 64M
sort_buffer_size        = 64M

我的 host1 my.cnf 增量

server-id = 3

我不知道是什么导致复制失败。我在此处发布之前查看了此 SO 链接答案,但我不太清楚我需要做什么。

Mysql Master Master ReplicationMySQL 复制 - 连接到 master 时出错,并且无法弄清楚我做错了什么。db 上的两个主机具有相同的用户名和密码。

4

0 回答 0