zoukankan      html  css  js  c++  java
  • MySQL(root用户)密码重置

    分别在Windows下和Linux下重置了MYSQL的root的密码: 
      在windows下:

      1:进入cmd,停止mysql服务:Net stop mysql

         到mysql的安装路径启动mysql,在bin目录下使用mysqld-nt.exe启动,

      2:执行:mysqld-nt --skip-grant-tables(窗口会一直停止)
      
         3:然后另外打开一个命入令行窗口,执行mysql(或者直接进入Mysql Command Line Cilent),此时无需输入密码即可进入。

      Java代码

      >use mysql

      >mysql> update mysql.user set authentication_string=password("123456") where user
    ="root";

      >flush privileges;

      >exit

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

      在重新启动mysql-nt服务,就可以用新密码登录了。

      在linux下:

      如果 MySQL 正在运行,首先杀之: killall -TERM mysqld。

      启动 MySQL :bin/safe_mysqld --skip-grant-tables &

      就可以不需要密码就进入 MySQL 了。

      然后就是

      Java代码

      >use mysql

      >update user set password=password("new_pass") where user="root";

      >flush privileges

      >use mysql >update user set password=password("new_pass") where user="root"; >flush privileges;

      重新杀 MySQL ,用正常方法启动 MySQL 。

  • 相关阅读:
    @loj
    @hdu
    @hdu
    转:sql之left join、right join、inner join的区别
    MySQL客户端Workbench
    转:js中this关键字详解
    转:jQuery弹出二级菜单
    转:ASP.NET 使用Ajax
    Python类的特点 (3) :静态方法与类方法
    Python类的特点 (2) :类属性与实例属性的关系
  • 原文地址:https://www.cnblogs.com/gaohj/p/3147875.html
Copyright © 2011-2022 走看看