分类: Mysql/postgreSQL
2016-04-15 09:25:12
+-------------------------+-------+
| host | user |
+-------------------------+-------+
| % | root |
| % | test3 |
| 10.9.15.% | rep1 |
| 10.9.15.% | test |
| 10.9.15.% | test2 |
| 10.9.15.0/255.255.255.0 | wang |
| 10.9.15.18 | root |
| 127.0.0.1 | root |
| ::1 | root |
| gp-master | root |
| gp-s1 | |
| gp-s1 | root |
| gp-s1 | test |
| gp-s3 | test |
| localhost | |
| localhost | root |
+-------------------------+-------+
16 rows in set (0.00 sec)
[root@gp-s1 ~]# mysql -urep1 -p123456 -h gp-s2
ERROR 1045 (28000): Access denied for user 'rep1'@'gp-s1' (using password: YES)
[root@gp-s3 ~]# mysql -urep1 -p123456 -h gp-s2
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 5.5.48-log MySQL Community Server (GPL)
Copyright (c) 2000, 2016, 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>
mysql> grant replication slave on *.* to 'rep1'@'10.9.15.19' identified by "123456";
[root@gp-s1 ~]# mysql -urep1 -p123456 -h gp-s2
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 34
Server version: 5.5.48-log MySQL Community Server (GPL)
Copyright (c) 2000, 2016, 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>
mysql>
mysql> select user(),current_user();
+------------+-----------------+
| user() | current_user() |
+------------+-----------------+
| rep1@gp-s1 | rep1@10.9.15.19 |
+------------+-----------------+
1 row in set (0.00 sec)
[root@gp-s3 ~]# mysql -urep1 -p123456 -h gp-s2
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 35
Server version: 5.5.48-log MySQL Community Server (GPL)
Copyright (c) 2000, 2016, 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@10.9.15.2 | rep1@10.9.15.% |
+----------------+----------------+
1 row in set (0.00 sec)
+-------------------------+----------+-------------------------------------------+
| host | user | password |
+-------------------------+----------+-------------------------------------------+
| % | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| % | test3 | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| 10.9.15.% | rep1 | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| 10.9.15.% | test | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| 10.9.15.% | test2 | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| 10.9.15.% | wchbsync | *55D02D8B1D286B078AC8DC9CD05E2D5D80906F3F |
| 10.9.15.0/255.255.255.0 | wang | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| 10.9.15.18 | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| 10.9.15.19 | rep1 | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| 10.9.15.19 | rep2 | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| 127.0.0.1 | root | |
| ::1 | root | |
| gp-master | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| gp-s1 | | | <---- 问题出在这里
| gp-s1 | root | |
| gp-s1 | test | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| gp-s3 | test | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| localhost | | |
| localhost | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
+-------------------------+----------+-------------------------------------------+
| gp-s1 | | | <---- 问题出在这里
| gp-s1 | root | |
| gp-s1 | test | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |