刚才的错误提示就该是:
提示如下错误:ERROR 1045: Access denied for user: 'dbuser@localhost' (Using password: YES)

解决方案 »

  1.   

    我也遇到过你的问题,后来卸载mysql重装,用root用户登录后,再试便没问题了!!
      

  2.   

    楼上的理解有误..grant all on *.* to dbuser@"%" identified by '123456';mysql -u dbuser -p 
    是一定会提示出错的.
    ERROR 1045: Access denied for user: 'dbuser@localhost' (Using password: YES)
    提示给的很清楚,你登录时实际上匹配的用户是 'dbuser@localhost' 
    而并没有匹配 'dbuser@%'怎么样才能使用  'dbuser@%' 帐号呢??????使用下面的语句登录,(假设你的 MySQL 安装在 192.168.0.1) 的主机上
    mysql -h 192.168.0.1 -u dbuser -p123456注意,一定要用IP地址....
      

  3.   

    我的怎么可以??c:\>ipconfigWindows 2000 IP ConfigurationEthernet adapter 本地连接:        Connection-specific DNS Suffix  . :
            IP Address. . . . . . . . . . . . : 192.168.0.98
            Subnet Mask . . . . . . . . . . . : 255.255.255.0
            IP Address. . . . . . . . . . . . : 192.168.0.100
            Subnet Mask . . . . . . . . . . . : 255.255.255.0
            Default Gateway . . . . . . . . . : 192.168.0.1c:\>mysql -uroot -p
    Enter password: ********
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 172 to server version: 4.0.17-max-debugType 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql> grant all on *.* to dbuser@"%" identified by '123456';
    Query OK, 0 rows affected (0.03 sec)mysql> exit
    Byec:\>mysql -udbuser -p
    Enter password: ******
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 174 to server version: 4.0.17-max-debugType 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql>
      

  4.   

    这是由于他的授权表中可能存在  Host = "localhost" User="" 的授权用户记录
     loveflea(coolwind) 建议你执行SELECT CURRENT_USER() ;
    返回当前会话被验证匹配的用户名: 
      

  5.   

    顺路提个问题
    我用grant all on *.* to dbuser@"%" identified by '123456'WITH GRANT OPTION;创建用户,并且执行flush privileges
    用mysql -u dbuser -p提示Enter password:输入密码'123456'报错ERROR 1045: Access denied for user: 'dbuser@localhost' (Using password: YES)如果不输入密码直接登陆可以,这是什么原因!!
      

  6.   

    楼上的,你的mysql.user有Host = "localhost" User="" 这个用户,删掉 then try again
    shuixin13(犬犬(心帆))  thanks 
    hehe,我的mysql.user没有Host = "localhost" User="" 的授权用户记录mysql> SELECT CURRENT_USER() ;
    +----------------+
    | CURRENT_USER() |
    +----------------+
    | dbuser@%       |
    +----------------+
    1 row in set (0.03 sec)mysql> use mysql;
    Database changed
    mysql> select host,user from user;
    +-----------+---------+
    | host      | user    |
    +-----------+---------+
    | %         | dbuser  |
    | localhost | root    |
    +-----------+---------+
    2 rows in set (0.00 sec)