当前位置: 公告/资讯>备案相关

 

  •     mysql重设密码
     

    在windows下:
    打开命令行窗口,停止mysql服务:net stop mysql
    启动mysql,一般到mysql的安装路径,找到 mysqld-nt.exe
    执行:mysqld-nt --skip-grant-tables
    另外打开一个命令行窗口,执行mysql
    >use mysql
    >update user set password=password("new_pass") where user="root";
    >flush privileges;
    >exit
    用Ctrl+Alt+Del,找到mysqld-nt的进程杀掉它,在重新启动mysql-nt服务,就可以用新密码登录了

    在linux下:
    如果 MySQL 正在运行,首先杀之: killall -TERM mysqld。 
    启动 MySQL :mysqld_safe --skip-grant-tables & 
    就可以不需要密码就进入 MySQL 了。 
    然后就是 
    >use mysql
    >update user set password=password("new_pass") where user="root";
    >flush privileges;
    重新杀 MySQL ,用正常方法启动 MySQL 。



    mysql5
    停止mysql5服务:在DOS窗口下输入net stop mysql5; 
      
    打开一个DOS窗口,按照顺序执行以下内容
    C:\Documents and Settings\administrator>cd ..
    C:\Documents and Settings>cd ..
    C:\>cd C:\PRogram Files\MySQL\MySQL Server 5.0\bin
    C:\PRogram Files\MySQL\MySQL Server 5.0\bin>mysqld-nt --skip-grant-tables
      
    再开一个DOS窗口,按照顺序执行
    C:\Documents and Settings\administrator>cd ..
    C:\Documents and Settings>cd ..
    C:\>cd C:\PRogram Files\MySQL\MySQL Server 5.0\bin
    C:\PRogram Files\MySQL\MySQL Server 5.0\bin>mysqld
    这样就进入了mysql>提示符,然后打开mysql数据库修改user中用户root的密码; 
      
    修改MySql密码
    mysql>use mysql
    mysql>update user set password=password("111212") where user="root";
    mysql>flush PRivileges;
    C:\PRogram Files\MySQL\MySQL Server 5.0\bin>exit

    使用任务管理器,找到mysqld-nt的进程,结束进程


    阅读次数:490

    上海雨祺信息科技有限公司

    发布日期: 2008-12-1


     

更多>>>

服务器、虚拟主机售前咨询

售后服务

其他联系方式

  • 淘宝旺旺:mengyu8505 点击这里给我发消息
  • MSN:wuqi@uduu.net
  • E-mail:sell@71688.com