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.

解决方案 »

  1.   

    mysql -hlocalhost  -ulumengb -plumengb1
      

  2.   

    mysql5.5的localhost和%是区别开的
      

  3.   

    好象还是出错啊C:\Program Files\MySQL\MySQL Server 5.1\bin>mysql -hlocalhost  -ulumengb -plumengb1
    ERROR 1045 (28000): Access denied for user 'lumengb'@'localhost' (using password: YES)
      

  4.   

    lumengb'@'localhost
    这个系统中已经明确定义了用户,所以MYSQL根据匹配原则会匹配| localhost | lumenga |这条记录。 而不是| %         | lumengb |