mysql 受權 user@'%' 爲何登錄的時候localhost 不行呢???

公司業務服務器還沒遷移到阿里雲上的時候,建立的一個用戶明明是全部的,可是本機登錄就是不行,一直也搞不懂緣由mysql

今天才知道 原來 %不包括 localhostsql

mysql> grant all on salt.* to salt@'%' identified by 'salt';服務器

Query OK, 0 rows affected (0.00 sec)ide

 

mysql> flush privileges;阿里雲

Query OK, 0 rows affected (0.00 sec)spa

 

[root@saltstack_s yum.repos.d]# mysql -u salt -psaltpasswd@123 -h localhost  #登錄不了的緣由。是由於上面受權的*不包括localhostinput

ERROR 1045 (28000): Access denied for user 'salt'@'localhost' (using password: YES)it

 

[root@saltstack_s ~]# mysql -usalt -p -h 192.168.92.128io

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

Your MySQL connection id is 2

Server version: 5.1.73 Source distribution

 

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>