windowsxp系统 mysql-5.0.11-beta-win32
提示:1045 access denied for user 'root'@'localhost' using password yes
前几天都好好的,昨天没弄,结果今天晚上过来提示上面的这个错误,重启mysql还是不可以
网上的方法看了几个但是不知道怎么弄
方法一: 
# /etc/init.d/mysql stop 
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking & 
# mysql -u root mysql 
mysql> UPDATE user SET Password=PASSWORD(’newpassword’) where USER=’root’; 
mysql> FLUSH PRIVILEGES; 
mysql> quit 
# /etc/init.d/mysql restart 
# mysql -uroot -p 
Enter password: <输入新设的密码newpassword> 
mysql> 
方法二: 
直接使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码: 
# mysql -udebian-sys-maint -p 
Enter password: <输入[client]节的密码> 
mysql> UPDATE user SET Password=PASSWORD(’newpassword’) where USER=’root’; 
mysql> FLUSH PRIVILEGES; 
mysql> quit 
# mysql -uroot -p 
Enter password: <输入新设的密码newpassword> 
mysql> 内容来自: 脚本之家 www.jb51.net 另一个方法
Windows:1. 管理员登陆系统,停止mysql服务或者结束mysqld-nt进程
2. 进入命令行,来到mysql的安装目录.假设安装目录为 d:\mysql\ , CMD进入命令行
3. 运行 d:\mysql\bin\mysqld-nt --skip-grant-tables 启动mysql,关闭权限的检查
4. 运行 d:\mysql\bin\mysqladmin -u root flush-privileges password "newpassword" 重设root密码
5. 重新启动mysql服务第4步也可以直接修改mysql表,所用到的SQL语句同linux部分,这里就不再重复了.请不要乱给答案否则不给分
一定要试验过的成功经验,谢谢!

解决方案 »

  1.   

    'mysqld_safe' 不是内部或外部命令,也不是可运行的程序
    或批处理文件。
    提示这个!
    #表示是在cmd后的命令行下输入的命令吧?你能把那些命令写清楚点吗,仿佛我上面在网上拷的有的空格什么的不太对,有的提示参数不对。着急中,谢谢 
      

  2.   

    那是在LINUX下的命令,换成WINDOWS下的就可以了。到WINDOWS的命令行了(‘DOS’ 下),切换到你的MySQL bin目录下。 比如我的是 C:\Program Files\MySQL\MySQL Server 5.1\bin
    然后敲下面的粗体的命令。注意你的my.ini位置。C:\Program Files\MySQL\MySQL Server 5.1\bin>mysqld  --defaults-file="C:\Program
    Files\MySQL\MySQL Server 5.1\my.ini" --console --skip-grant-tables
    090515 22:06:09 [Warning] The syntax '--log' is deprecated and will be removed i
    n MySQL 7.0. Please use '--general_log'/'--general_log_file' instead.
    090515 22:06:09 [Warning] The syntax '--log_slow_queries' is deprecated and will
     be removed in MySQL 7.0. Please use '--slow_query_log'/'--slow_query_log_file'
    instead.
    090515 22:06:09 [Warning] The syntax '--log' is deprecated and will be removed i
    n MySQL 7.0. Please use '--general_log'/'--general_log_file' instead.
    090515 22:06:09 [Warning] The syntax '--log_slow_queries' is deprecated and will
     be removed in MySQL 7.0. Please use '--slow_query_log'/'--slow_query_log_file'
    instead.
    090515 22:06:09 [ERROR] The update log is no longer supported by MySQL in versio
    n 5.0 and above. It is replaced by the binary log. Now starting MySQL with --log
    -bin='' instead.
    090515 22:06:09  InnoDB: Started; log sequence number 0 324221
    090515 22:06:09 [Note] mysqld: ready for connections.
    Version: '5.1.33-community-log'  socket: ''  port: 3306  MySQL Community Server
    (GPL)看到这个结果就说明MySQL已经起来了。
    再开一个DOS窗口,同样切到mysql bin目录下,
    C:\Program Files\MySQL\MySQL Server 5.1\bin>mysql -uroot mysql
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 2
    Server version: 5.1.33-community-log MySQL Community Server (GPL)Type 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql>到这,你就继续按 方法一:操作就行。update完表后,退出,然后
    C:\Program Files\MySQL\MySQL Server 5.1\bin>mysqladmin shutdown之后正常重启MySQL服务就行了。
      

  3.   

    还是提示'mysqld_safe' 不是内部或外部命令,也不是可运行的程序或批处理文件。 在bin目录下有mysqld-debug.exe和mysqld-nt.exe。你是不是弄错了。你试过吗?那个方法可行吧?
      

  4.   

    楼主能不能认真看一下回复?仔细看一下三楼。哪儿有 mysqld_safe ????
      

  5.   

    写错了,还是提示还是提示'mysqld' 不是内部或外部命令,也不是可运行的程序或批处理文件。我就按照三楼的命令输入的
      

  6.   

    到WINDOWS的命令行了(‘DOS’ 下),切换到你的MySQL bin目录下。 比如我的是 C:\Program Files\MySQL\MySQL Server 5.1\bin
    然后敲下面的粗体的命令。注意你的my.ini位置。上面这段字你看了吗?!
      

  7.   


    对不起,哪个图怎么贴上来,他老是提示要输入http://。我不知道该怎么弄。可不可以告诉一下,谢谢了
      

  8.   

    我照着三楼的错误如下。
    C:\Program Files\MySQL\MySQL Server 5.1\bin>mysqld  --defaults-file="C:\Program
    Files\MySQL\MySQL Server 5.1\my.ini" --console --skip-grant-tables
    090524  6:40:13  InnoDB: Operating system error number 32 in a file operation.
    InnoDB: The error means that another program is using InnoDB's files.
    InnoDB: This might be a backup or antivirus software or another instance
    InnoDB: of MySQL. Please close it to get rid of this error.
    090524  6:40:23  InnoDB: Operating system error number 32 in a file operation.
    InnoDB: The error means that another program is using InnoDB's files.
    InnoDB: This might be a backup or antivirus software or another instance
    InnoDB: of MySQL. Please close it to get rid of this error.
    请教三楼上边是什么错误。。
    楼主的问题我曾上网搜过,别人写的方法我都没有试验成功,我看权威指南写的方法,我试验成功了。
    net stop mysql 停用服务
    {mysqld]
    skip_grant_tables(加上这句话)
    你把你的bin目录加入path路径里边 在dos里边输入 mysql -uroot -p 就可进入mysql在修改密码了。。
      

  9.   

    Binlogging on server not active 这是什么错误????
      

  10.   

    to magnet2008 , 你的错误信息, 你的
    InnoDB: The error means that another program is using InnoDB's files.这个文件正在被其实程序使用中。检查一下你的mysqld有没有关闭,或者有没有什么程序在锁定这个文件。
      

  11.   

    to acmain_chm
    好像不需要关闭mysql服务,关闭反而报错,说连接不上。
    现在我运行成功了,可能是我一次开了两个客户端,导致不能运行mysqldump
    十分感谢,我有时在csdn上边问的问题,很感谢你的回答。。
      

  12.   

    求助问题依旧
    C:\Program Files\MySQL\MySQL Server 5.0\bin>mysqld --defaults-file="C:\Program F
    iles\MySQL\MySQL Server 5.0\my.ini" --console --skip-grant-tables
    'mysqld' 不是内部或外部命令,也不是可运行的程序
    或批处理文件。C:\Program Files\MySQL\MySQL Server 5.0\bin>
    这是我的按照三楼步骤弄的,第一步就出现这个
    我的bin文件夹下面有这几个mysqld-debug.exe  mysqld-debug.map  mysqld-debug.pdb  mysqld-debug.pdb  mysqld-nt.map  mysqld-nt.pdb 跟mysqld有关的,是不是我的bin里少东西呢?
      

  13.   

    少东西了,重新安装吧。这是我目录中的。[code=BatchFile]C:\Program Files\MySQL\MySQL Server 5.1\bin>dir mysqld*.exe
     Volume in drive C is xxxxxx
     Volume Serial Number is xxxxxxx-xx Directory of C:\Program Files\MySQL\MySQL Server 5.1\bin03/16/2009  01:28p          10,715,776 mysqld-debug.exe
    03/16/2009  01:29p           6,562,432 mysqld.exe
    03/16/2009  01:29p           2,331,264 mysqldump.exe
                   3 File(s)     19,609,472 bytes
                   0 Dir(s)  32,020,001,280 bytes freeC:\Program Files\MySQL\MySQL Server 5.1\bin>[/code]
      

  14.   

    windowsxp系统 mysql-5.0.11-beta-win32
    提示:1045 access denied for user 'root'@'localhost' using password yes如果有这个提示,说明你的mysqld已经在运行了。
      

  15.   

    我的mysql能启动,但是打开mysql命令行一输入密码回车就嘀的一声把mysql的命令行自动关闭了。而且我用navicat 8.0 for myslq前台工具测试连接就提示:1045 access denied for user 'root'@'localhost' using password yes 
    不知道该怎么办了,反正重装过几次,每次装完是好的,但是第二天来就提示这个错误了
      

  16.   

    看一下你的 service 中的MySQL服务的命令是什么?
    windows 控制面板,服务。
      

  17.   

    怎么查看啊,我到服务里了,对mysql右键也没有的啊
      

  18.   

    怎么我的是出现D:\Program 不是内部或外部命令呢?
      

  19.   

    c:\>sc stop mysql
    c:\>mysqld  --defaults-file="C:\MySQL\MySQLServer6.0\my.ini" --console --skip-grant-tables
    重新开一个cmd
    c:\>mysql -uroot -p
    enter password: <- 回车
    mysql>UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
    mysql>FLUSH PRIVILEGES;
    mysql>quit
      

  20.   

    我也遇到这问题了,安装好 mysql 用的好好的,可是今天登陆时报这个错,
    以上的方法我到是没用,就是先停止服务,再重新启动服务就OK!
      

  21.   

    搞了我一天,直到我看到了这个帖子,才解决了这个问题。
    非常感谢ACMAIN_CHM,
    向活跃在CSDN中的所有如ACMAIN_CHM一样,耐心、专业的高手们致敬!
    分享最快乐,怎能少的了你们呢?
      

  22.   

    打开http://localhost/phpmyadmin出现这问题的:
    1045 access denied for user 'root'@'localhost' using password yes
    Windows:1. 管理员登陆系统,停止mysql服务或者结束mysqld-nt进程
    2. 进入命令行,来到mysql的安装目录.假设安装目录为 d:\mysql\ , CMD进入命令行
    3. 运行 d:\mysql\bin\mysqld-nt --skip-grant-tables 启动mysql,关闭权限的检查
    4. 运行 d:\mysql\bin\mysqladmin -u root flush-privileges password "newpassword" 重设root密码
    5. 重新启动mysql服务
    这个方法,我试过,可行。就是在cmd里输入mysqld-nt --skip-grant-tables然后重启mysql服务,然后再打开http://localhost/phpmyadmin就行了
      

  23.   

    最简单的方法就是在任务管理器里结束mysqld-nt进程,再重新启动就可以了
      

  24.   

    呵呵 我自己也是菜鸟一个,希望找个师傅学学PHP知识,自己在网上找的答案把config改成cookie都无法解决。自己研究10分钟搞定。
    原来我只把主机为localhost的密码修改啦,出现“#1045 - Access denied for user 'root'@'localhost' (using password: NO)”这样的错误,后来我把主机为127.0.0.1也修改为相同的密码后问题解决。最后希望大家到我的站指点下 http://www.szbenben.com/
      

  25.   

    我也碰到这个问题,弄了很久,郁闷至极的时候发现mysql下面有个resetroot.BAT,可以清除PMA和ROOT的密码---}
      

  26.   

    此方法无效,具体只需要再mysql里面操作即可,删除全局配置,重新添加用户即可,不明白可以加qq751429788
      

  27.   

    此方法无效,具体只需要再mysql里面操作即可,删除全局配置,重新添加用户即可,不明白可以加qq751429788不能贴图,能贴图我就贴图了,网上很多说的不对,具体报错就是#1045 - Access denied for user 'users'@'localhost' (using password: YES)
      

  28.   

    感谢ACMAIN_CHM兄的解释,我遇到同样的问题,看着3楼的解释解决了,同时对ACMAIN_CHM兄的毅力钦佩一下,很负责。如果我是你,我真坚持不到23楼。
      

  29.   

    大哥,mysql真不是微软的东西。
      

  30.   

    非常非常感谢 ACMAIN_CHM 大哥的指点,终于可以连上了。。谢谢大家了
      

  31.   

    除了ACMAIN_CHM大哥所说的少东西了之外。
    还有一种可能,就是mysqld被系统(比如防火墙)阻止运行了,虽然出现在进程栏,但是没有真正启动起来。
    我用的是win7,解除阻止后就出来了。 
      

  32.   

    最根本的是权限问题 安装是导致root用户被拒绝所以无论输入密码是否正确都是无法登陆 
    试试装个phpmyadmin 使用管理界面登陆删除拒绝的用户 红色部分即可。
      

  33.   

    命令提示符 net stop mysql 停止mysql服务
    C:\Documents and Settings\tony>net stop mysql
    MySQL 服务正在停止.
    MySQL 服务已成功停止。进入bin目录
    C:\Documents and Settings\tony>cd C:\Program Files\MySQL\MySQL Server 5.0\bin
    C:\Program Files\MySQL\MySQL Server 5.0\bin>mysqld-nt --skip-grant-tables
    重新打开一个命令提示符窗口
    进入bin目录
    C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql
    mysql> use mysql;
    mysql> update user set password=password("123") where user="root";
    mysql> flush privileges;重新启动mysql服务 net start mysql 修改成功!
      

  34.   

    最根本的是权限问题 安装是导致root用户被拒绝所以无论输入密码是否正确都是无法登陆  
      

  35.   

    5.5.13的版本如果不修改datadir=C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.5\data成功连接。
    如果一修改为其他盘就出现1045的错误了!
      

  36.   


    按照你的做法我出现如下错误是什么意思 谢谢
    C:\Program Files\MySQL\MySQL Server 5.1\bin>mysqld --defaults-file="C:\Program
    Could not open required defaults file: C:\Program
    Fatal error in defaults handling. Program aborted
    110626 22:26:27 [Warning] Can't create test file C:\Program Files\MySQL\MySQL Se
    rver 5.1\data\microsof-679b67.lower-test
    110626 22:26:27 [Warning] Can't create test file C:\Program Files\MySQL\MySQL Se
    rver 5.1\data\microsof-679b67.lower-test
    mysqld: Can't change dir to 'C:\Program Files\MySQL\MySQL Server 5.1\data\' (Err
    code: 2)
    110626 22:26:27 [ERROR] Aborting110626 22:26:27 [Note] mysqld: Shutdown complete
    C:\Program Files\MySQL\MySQL Server 5.1\bin>Files\MySQL\MySQL Server 5.1\my.ini"
     --console --skip-grant-tables
    系统找不到指定的路径。C:\Program Files\MySQL\MySQL Server 5.1\bin>
      

  37.   

    这个问题我差点疯了!还是解决了!
      基本上的安装步骤大家都清楚,如果出现上述的安装错误,先在控制面板删除,在到安装路径删除
         1、改变安装路径
          2、其他安装照旧
           3、在please set the windows service(这个页面选取:Include bin directory in windows path)
           4、进行下一步就可以了!
    如果在添加密码时有三个框,都填一样就可以了!
      

  38.   

    命令提示符 net stop mysql 停止mysql服务
    C:\Documents and Settings\tony>net stop mysql
    MySQL 服务正在停止.
    MySQL 服务已成功停止。进入bin目录
    C:\Documents and Settings\tony>cd C:\Program Files\MySQL\MySQL Server 5.0\bin
    C:\Program Files\MySQL\MySQL Server 5.0\bin>mysqld-nt --skip-grant-tables
    重新打开一个命令提示符窗口
    进入bin目录
    C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql
    mysql> use mysql;这样,查看user表信息,更改user表,随便你怎么改
      

  39.   

    工昨天安装的一个mysql昨天 是可以正常使用的,可是等到我今天早上来打开数据库的时候就是提示了
    1045 - access deied for user:'root@localhost'(using password:yes)
    这样的错误提示信息,当我看到这个贴的时候我就是开启了那个mysql51那个服务就可以了,
    因为他是任务管理器里面有两服务的,一个是mysql服务另一个就是mysql51了,然而我安装的时候选择
    的就是mysql51了,而系统启动的时候就是默认开启了,第一个服务的即mysql,结果我就,结束mysql
    服务而开启第二个服务mysql51就没有问题了,正常打开了。
      

  40.   

    3楼正解,多谢您了,呵呵!我是win7,安的wamp包,新手,和我一样的问题可以试试。
      

  41.   

    第一种:结果是:ERROR 1046 (3D000): No database selected
      

  42.   


    只有一个mysql啊,哪里有mysql51
      

  43.   

    eclipse里面运行后出现的这个是怎么的呢?数据库连接没问题啊
      

  44.   

    谢谢3楼的ACMAIN_CHM,问题已经解决