[MySQL fault] ERROR1045 (28000): Accessdeniedforuser bitsCN.com
[MySQL fault] ERROR 1045 (28000): Access denied for user 'Mmm _ agent' @ 'exxx -tx.com '(using password: YES)
1 error login error
[Python]
[Uxxx @ exxx-0702 ~] $ Mysql -hexxx-tx.com -- user = 'Mmm _ agent' -- password = '# tx $'
ERROR 1045 (28000): Access denied for user 'Mmm _ agent' @ 'exxx -tx.com '(using password: YES)
2. remove the-h parameter and log on smoothly.
[Python]
[Uxxx @ exxx-0702 ~] $ Mysql -- user = 'Mmm _ agent' -- password = '# tx $'
Welcome to the MySQL monitor. Commands end with; or/g.
Your MySQL connection id is 491
Server version: 5.x. xa-log MySQL tx Reltxse
Copyright (c) 2000,201 1, 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 cltxr the current input statement.
Mysql>
3 Is there a limit on the-h parameter? Try another user
[SQL]
Mysql> grant all privileges on *. * TO 'MG '@' % 'identified by' # tx $ ';
Query OK, 0 rows affected (0.01 sec)
Mysql> exit
[Uxxx @ exxx-0702 ~] $ Mysql -hexxx-tx.com -- user = 'MG '-- password =' # tx $'
Welcome to the MySQL monitor. Commands end with; or/g.
Your MySQL connection id is 965
Server version: 5.x. xa-log MySQL tx Reltxse
Copyright (c) 2000,201 1, 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 cltxr the current input statement.
Mysql>
It seems that it is not a restriction on the-h parameter, it should be another fault, and the password is OK.
4. check the mmm_agent user.
[SQL]
Mysql> select user, host from mysql. user where user = 'Mmm _ agent ';
+ ----------- + ------ +
| User | host |
+ ----------- + ------ +
| Mmm_agent | % |
| Mmm_agent | 10.% |
+ ----------- + ------ +
2 rows in set (0.00 sec)
Mysql> show grants for mmm_agent @ '% ';
+ Shards +
| Grants for mmm_agent @ % |
+ Shards +
| Grant all privileges on *. * TO 'Mmm _ agent' @ '%' identified by password' * 77074D8AC9603904375ED54F1D2E14CDACB7842F '|
+ Shards +
1 row in set (0.00 sec)
Mysql> show grants for mmm_agent @ '10.% ';
+ Certificate ------------------- +
| Grants for mmm_agent @ 10.% |
+ Certificate ------------------- +
| Grant reload, PROCESS, SUPER, replication client on *. * TO 'Mmm _ agent' @ '10.% 'identified by password' * 6745119376CF6BD5E0F0A50484A91AE7BD172612' |
| Grant execute on 'audit'. * TO 'Mmm _ agent' @ '10.% '|
+ Certificate ------------------- +
2 rows in set (0.00 sec)
Mysql>
-- We can see that there are two accounts with the same user name, different hosts, and different passwords. then we set host to 10. change the password of the mmm_agent user of % to the same password as the mmm_agent user whose host is %. try again.
[SQL]
Grant reload, PROCESS, SUPER, replication client on *. * TO 'Mmm _ agent' @ '10.% 'identified by' # tx $ ';
Grant execute on 'audit'. * TO 'Mmm _ agent' @ '10. %'
Mysql> grant reload, PROCESS, SUPER, replication client on *. * TO 'Mmm _ agent' @ '10.% 'identified by' # tx $ ';
Query OK, 0 rows affected (0.01 sec)
Mysql> grant execute on 'audit'. * TO 'Mmm _ agent' @ '10. %'
->;
Query OK, 0 rows affected (0.00 sec)
Mysql> exit
Bye
[Uxxx @ exxx-0702 ~] $ Mysql -hexxx-tx.com -- user = 'Mmm _ agent' -- password = '# tx $'
Welcome to the MySQL monitor. Commands end with; or/g.
Your MySQL connection id is 1191
Server version: 5.x. xa-log MySQL tx Reltxse
Copyright (c) 2000,201 1, 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 cltxr the current input statement.
Mysql>
[SQL]
-- The-h parameter is successfully used to log on to mysql.
[Conclusion]:
Well, you can use [uxxx @ exxx-0702 ~] $ Mysql -hexxx-tx.com -- user = 'Mmm _ agent' -- password = '# tx $' is successfully logged on.
When mysql calls the-h parameter, if the user name is the same, in the host selection, first match a user with a small range. in this case, % ratio is 10. the range of % is much larger. Therefore, when you use -hexxx-tx.com-ummm_agent for access, the value of % matches 10 with a smaller range. % user, and mmm_agent @ '10.% 'the password of the user is not the same as that of the mmm_agent @' % '. the following password error message is returned:
ERROR 1045 (28000): Access denied for user 'Mmm _ agent' @ '%' (using password: YES)
BitsCN.com