1 Login With the previous MySQL login mode
[mysql@eanintmydbc002db1 mysqllog]$ mysql Enter password:
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 3157186
Server version:5.5.25a-log MySQL EA Release
Copyright (c), the Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark the Oracle Corporation and/or its
Affiliates. Names may trademarks of their respective
Owners.
Type ' help, ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
Mysql> select Current_User ();
+----------------+
| Current_User () |
+----------------+
| @localhost |
+----------------+
1 row in Set (0.01 sec)
Mysql>
Mysql>
2 Strange, try to land again
[MYSQL@XXXMYDBC002DB1 mysqllog]$ MySQL
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 3157145
Server version:5.5.25a-log MySQL EA Release
Copyright (c), the Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark the Oracle Corporation and/or its
Affiliates. Names may trademarks of their respective
Owners.
Type ' help, ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
Mysql> show Processlist;
ERROR 1227 (42000): Access denied; Need (at least one of) the PROCESS privilege (s) for this operation
Mysql> select Current_User ();
+----------------+
| Current_User () |
+----------------+
| @localhost |
+----------------+
1 row in Set (0.00 sec)
See here unexpectedly no username, only IP address for localhost, a very strange situation, look at the current process of all
Mysql> Show full processlist;
ERROR 1227 (42000): Access denied; Need (at least one of) the PROCESS privilege (s) for this operation
Mysql>
3 to use the standard landing mode mysql-uroot-p-hlocalhost Landing test, to see where the problem is.
[NOVAMYSQLADMININT@XXMYDBC002DB1 ~]$ mysql-uroot-p-hlocalhost
Enter Password:
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 3257823
Server version:5.5.25a-log MySQL EA Release
Copyright (c), the Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark the Oracle Corporation and/or its
Affiliates. Names may trademarks of their respective
Owners.
Type ' help, ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
Mysql> select User,host from Mysql.user;
+--------------+-------------------------------------+
| user | Host |
+--------------+-------------------------------------+
| mmm_agent | % |
| Mmm_monitor | % |
| Replication | % |
| Root | % |
| Root | 127.0.0.1 |
| Root | :: 1 |
| | localhost | There is this user, then check the user exactly what permissions.
| Nuc_monitor | xx.xx.abn-iad.xx.com |
| Nuc_monitor | xx.xx.abn-iad.xx.com |
+--------------+-------------------------------------+
Rows in Set (0.00 sec)
Mysql> Show grants for ' @ ' localhost ';
+--------------------------------------+
| Grants for @localhost |
+--------------------------------------+
| GRANT USAGE on *.* to ' @ ' localhost ' | See here, this user only gives the Useage permission, may connect above, but does not have any operation.
+--------------------------------------+
1 row in Set (0.00 sec)
Mysql>
Solution: This means that your permission has been withdrawn. But there's a record of you in the user's list. What you need to do is to reassign this user privilege or drop off this useless account for a standard account login.
Why.
in the binlog inside to see the operation Records and their usual work record, found that a colleague in cleaning up the account, remove the ' @ ' localhost ' permission, but did not drop this user, so in the default MySQL landing, Preference was given to ' @ ' localhost ' instead of ' root ' @ ' localhost ', but the question is, why does MySQL take precedence over the ' @ ' localhost account instead of ' root ' localhost ' landing.
query A lot of information and discussions with netizens, the result is the implementation of MySQL, automatic system sa user's way to login, if there is no MySQL account with the same name SA, priority to "landing, if not, the root account login, such as the current system account is MySQL, Sort the following if SA is MySQL::
1 ' @ ' localhost '
2 ' mysql ' @ ' localhost '
3 ' @ ' localhost '
4 ' root ' @ ' localhost '