MySQL复制错误2003 [英] MySQL replication error 2003

查看:88
本文介绍了MySQL复制错误2003的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在两个linux盒之间建立复制.

我的主服务器和从服务器都在LAN上,它们可以互相ping通,并且可以telnet ip 3306,这意味着mysql端口在两端都是打开的.

我在主服务器和从服务器上创建了一个复制用户:

change master to master_host ='master_ip';
change master to master_user ='replicator';
change master to master_password ='password';

主人在显示主人状态时给出以下提示:

+------------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000001 |   546050 |              |                  |
+------------------+----------+--------------+------------------+
1 row in set (0.01 sec)

我在显示从属状态时遇到以下错误:

Slave_IO_Running: Connecting
Slave_SQL_Running: Yes
..
Last_IO_Errno: 2003
Last_IO_Error: error connecting to master 'replicator@master_ip:3306' - retry-time: 60  retries: 86400

有人对这可能是什么有任何想法,或者您可能需要任何其他信息?

在从站上,显示从站状态\ G的最后一行是:

Master_Server_Id:0

不是说1是主人的ID吗?

解决方案

您无需在GRANT语句后刷新特权.来自MySQL文档.

如果直接使用诸如INSERT,UPDATE或DELETE之类的语句修改授权表,则在重新启动服务器或告诉服务器重新加载表之前,所做的更改不会影响特权检查.如果直接更改授权表但忘记重新加载它们,则更改将在重新启动服务器之前无效.这可能会让您想知道为什么您的更改似乎没有任何作用!

要告诉服务器重新加载授权表,请执行flush-privileges操作.这可以通过发出FLUSH PRIVILEGES语句或执行mysqladmin flush-privileges或mysqladmin reload命令来完成.

如果使用帐户管理语句(例如GRANT,REVOKE,SET PASSWORD或RENAME USER)间接修改授权表,则服务器会注意到这些更改并立即将授权表再次加载到内存中.

I'm trying to establish replication between two linux boxes.

My master and slave are on LAN, both can ping each other and can telnet ip 3306, meaning the mysql ports are open on both ends.

I created a replication user on master and on slave:

change master to master_host ='master_ip';
change master to master_user ='replicator';
change master to master_password ='password';

Master gives this when showing master status:

+------------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000001 |   546050 |              |                  |
+------------------+----------+--------------+------------------+
1 row in set (0.01 sec)

I'm getting the following error on show slave status:

Slave_IO_Running: Connecting
Slave_SQL_Running: Yes
..
Last_IO_Errno: 2003
Last_IO_Error: error connecting to master 'replicator@master_ip:3306' - retry-time: 60  retries: 86400

Anyone has any ideas as to what this could be, or any other info you may need?

EDIT:

On the slave the last line of show slave status\G reads:

Master_Server_Id: 0

Shouldn't that say 1 as that is master's ID?

解决方案

You don't need to flush privileges after GRANT statement. From MySQL documentation.

If you modify the grant tables directly using statements such as INSERT, UPDATE, or DELETE, your changes have no effect on privilege checking until you either restart the server or tell it to reload the tables. If you change the grant tables directly but forget to reload them, your changes have no effect until you restart the server. This may leave you wondering why your changes seem to make no difference!

To tell the server to reload the grant tables, perform a flush-privileges operation. This can be done by issuing a FLUSH PRIVILEGES statement or by executing a mysqladmin flush-privileges or mysqladmin reload command.

If you modify the grant tables indirectly using account-management statements such as GRANT, REVOKE, SET PASSWORD, or RENAME USER, the server notices these changes and loads the grant tables into memory again immediately.

这篇关于MySQL复制错误2003的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆