手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

MySQL 5.6主从复制及遇到的错误

[日期:2013-09-23] 来源:Linux社区  作者:quanliyadan [字体:大 中 小]

4、测试

在master上新建表,

MySQL> use blog;
Database changed
mysql> create table hi_tb(id int(3),name char(10));
Query OK, 0 rows affected (0.14 sec)


mysql> show tables;
+----------------+
| Tables_in_blog |
+----------------+
| hi_tb          |
+----------------+
1 row in set (0.00 sec)


在slave查看

mysql> use blog;
Database changed
mysql> show tables;
Empty set (0.00 sec)


mysql slave没有发现新建的表,说明主从复制中间出了问题,所以需要查看mysql错误日志

tail  -f  /var/log/mysql/mysql.error

2013-09-22 15:39:21 2150 [Warning] Storing MySQL user name or password information in the master.info repository is not secure and is therefore not recommended. Please see the MySQL Manual for more about this issue and possible alternatives.
2013-09-22 15:39:21 2150 [Note] Slave I/O thread: connected to master 'master@192.168.254.46:3306',replication started in log 'mysql-bin.000011' at position 330
2013-09-22 15:39:21 2150 [Warning] Slave SQL: If a crash happens this configuration does not guarantee that the relay log info will be consistent, Error_code: 0
2013-09-22 15:39:21 2150 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000011' at position 330, relay log './wordpress-relay-bin.000001' position: 4
2013-09-22 15:39:21 2150 [ERROR] Slave I/O: Master command COM_REGISTER_SLAVE failed: Access denied for user 'master'@'192.168.254.153' (using password: YES) (Errno: 1045), Error_code: 1597
2013-09-22 15:39:21 2150 [ERROR] Slave I/O thread couldn't register on master
2013-09-22 15:39:21 2150 [Warning] Slave I/O: Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again, log 'mysql-bin.000011' at position 330, Error_code: 1597
2013-09-22 15:39:21 2150 [Warning] Storing MySQL user name or password information in the master.info repository is not secure and is therefore not recommended. Please see the MySQL Manual for more about this issue and possible alternatives.
2013-09-22 15:39:21 2150 [ERROR] Slave I/O: Master command COM_REGISTER_SLAVE failed: Access denied for user 'master'@'192.168.254.153' (using password: YES) (Errno: 1045), Error_code: 1597
2013-09-22 15:39:21 2150 [ERROR] Slave I/O thread couldn't register on master

 

 

错误原因,没有在master上给master用户授权!!

mysql> select * from hi_tb;  (master)
+------+------+
| id  | name |
+------+------+
|    1 | bobu |
|    2 | dsfa |
+------+------+
2 rows in set (0.00 sec)


mysql> select * from hi_tb;  (slave)
+------+------+
| id  | name |
+------+------+
|    1 | bobu |
|    2 | dsfa |
+------+------+
2 rows in set (0.01 sec)


实现了同步。

最后,再次对比一下主从的二进制日志

MySQL 5.6主从复制及遇到的错误

linux
相关资讯       MySQL主从复制  MySQL 5.6 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款