zoukankan      html  css  js  c++  java
  • MySQL重置root密码

    你可以按照以下简单的五步来重置MySQL数 据库服务器密码。第一步,停止MySQL服务器。第二步,使用–skip-grant-tables选择启动mysqld进程以便解除要求密码登录提示。 第三步,以root用户连接mysql服务器。第四步,设置一个新的mysql root用户密码。第五步,退出并重启mysql服务器。以下给出每步的具体命令。

    1、停止mysql服务

    1. /etc/init.d/mysql stop

    输出:
    Stopping MySQL database server: mysqld.

    2、设置忽略密码启动mysql服务器

    1. mysqld_safe --skip-grant-tables &

    输出:
    [1] 5988
    Starting mysqld daemon with databases from /var/lib/mysql
    mysqld_safe[6025]: started

    3、使用mysql客户端连接mysql服务器

    1. mysql -u root

    输出:
    Welcome to the MySQL monitor. Commands end with ; or g.
    Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log

    Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the buffer.

    mysql>

    4、设置一个新的mysql root用户密码

    1. mysql> use mysql;
    2. mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
    3. mysql> flush privileges;
    4. mysql> quit

    5、停止mysql服务器

    1. /etc/init.d/mysql stop

    输出:
    Stopping MySQL database server: mysqld
    STOPPING server from pid file /var/run/mysqld/mysqld.pid
    mysqld_safe[6186]: ended

    [1]+ Done mysqld_safe –skip-grant-tables

    6、启动mysql服务器并测试

      1. /etc/init.d/mysql start
      2. mysql -u root -p
  • 相关阅读:
    codeforces_Codeforces Round #541 (Div. 2)_abc
    小米 OJ 编程比赛 01 月常规赛_灯_找规律
    codeforces_A. Salem and Sticks_数组/暴力
    航班座位_hihocoder
    canvas
    你所必须知道的HTML
    表单及表单新增元素
    HTML5新增的结构元素
    jQuery菜单,导航与标签页
    JavaScript的DOM对象
  • 原文地址:https://www.cnblogs.com/webu/p/2905580.html
Copyright © 2011-2022 走看看