mysql> select host, user from user;
+-----------+---------+
| host | user |
+-----------+---------+
| % | lumengb |
| % | root |
| localhost | lumenga |
| localhost | root |
+-----------+---------+
4 rows in set (0.00 sec)C:\Program Files\MySQL\MySQL Server 5.1\bin>mysql -ulumengb -plumengb1
ERROR 1045 (28000): Access denied for user 'lumengb'@'localhost' (using password: YES)C:\Program Files\MySQL\MySQL Server 5.1\bin>mysql -ulumenga -plumenga1
Welcome to the MySQL monitor. Commands end with ; or \g.
ERROR 1045 (28000): Access denied for user 'lumengb'@'localhost' (using password: YES)
这个系统中已经明确定义了用户,所以MYSQL根据匹配原则会匹配| localhost | lumenga |这条记录。 而不是| % | lumengb |