Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2835109
  • 博文数量: 200
  • 博客积分: 2413
  • 博客等级: 大尉
  • 技术积分: 3067
  • 用 户 组: 普通用户
  • 注册时间: 2011-04-01 22:07
文章分类

全部博文(200)

文章存档

2018年(2)

2017年(8)

2016年(35)

2015年(14)

2014年(20)

2013年(24)

2012年(53)

2011年(44)

分类: Mysql/postgreSQL

2016-04-13 14:58:19


通过MHA manger节点登录gp-s2主库;gp-s1、gp-s3两台mysql 从库,这两台从库都是用主库gp-s1的备份恢复的,rep1用户的权限应该是一致性的。
通过select user(),current_user() ;命令发现权限不同。

从库gp-s1的rep1用户权限是错误的。

# mysql -urep1 -p123456 -hgp-s1

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.5.48-log MySQL Community Server (GPL)

 

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

 

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 

mysql> select user(),current_user() ;

+--------+----------------+

| user() | current_user() |

+--------+----------------+

| rep1@  | @              |

+--------+----------------+

1 row in set (0.00 sec)



主库gp-s2中的rep1权限是正确的。

# mysql -urep1 -p123456 -hgp-s2

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 219

Server version: 5.5.48-log MySQL Community Server (GPL)

 

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

 

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 

mysql> select user(),current_user() ;

+----------------+----------------+

| user()         | current_user() |

+----------------+----------------+

| rep1@gp-master | rep1@10.9.15.% |

+----------------+----------------+

1 row in set (0.00 sec)


从库gp-s3的rep1用户权限是错误的。

# mysql -urep1 -p123456 -hgp-s3

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 11

Server version: 5.5.48-log MySQL Community Server (GPL)

 

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

 

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 

mysql> select user(),current_user() ;

+----------------+----------------+

| user()         | current_user() |

+----------------+----------------+

| rep1@gp-master | rep1@%         |

+----------------+----------------+

1 row in set (0.00 sec)



通过查询mysql.user表,rep1的权限都一致。
很是疑惑为什么mysql.user表中的数据相同,为什么在MHA的manager节点显示的权限不同。

在走投无路时,想到了SHOW GRANTS\G命令。正是通过该命令找出了问题的原因。

在MHA manager上,登录从库gp-s1,查询rep1权限。很明显看到错误了,原来是gp-s1开启了--skip-grant-tables参数,造成跳过授权表,mysql.user表不起作用。

# mysql -urep1 -p123456 -hgp-s1

mysql> SHOW GRANTS\g

ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement


解决办法:
去掉mysql参数文件中的--skip-grant-tables参数。


转载请注明:
十字螺丝钉
http://blog.chinaunix.net/uid/23284114.html

QQ:463725310
E-MAIL:houora#gmail.com(#请自行替换为@)

阅读(5512) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~