zoukankan      html  css  js  c++  java
  • linux

    1, 关闭mysql服务

    /etc/rc.d/init.d/mysqld stop


    2,使用 –skip-grant-tables选项启动mysql服务

    (1)打开文件 mysqld

    vi /etc/rc.d/init.d/mysqld

    (2)编辑文件 mysqld,在下面运行启动的语句里增加--skip-grant-tables

    /usr/bin/mysqld_safe --skip-grant-tables --datadir="$datadir" --socket="$socketfile"

    --log-error="$errlogfile" --pid-file="$mypidfile"

    加入--skip-grant-tables的意思是启动mysql服务的时候跳 过权限表认证。启动后,连接到mysql的root不需要口令

    3,重新启动mysql服务

    /etc/rc.d/init.d/mysqld start

    4,登录mysql

     mysql -u root -h 127.0.0.1 -P3306 -p

    备注:直接回车进入就好,此时不输入密码也可以登录mysql

    5,修改root用户的密码

    mysql> select host,user,password from mysql.user;

    mysql> update mysql.user set password=password('1111') where user='root';

    mysql> flush privileges;

    mysql> quit


    5, 重新启动mysql,就可以使用 新密码登录了

    /etc/rc.d/init.d/mysqld restart   //重新启动mysql

    mysql -u root -h 127.0.0.1 -P3306 -p

    输入密码:123456

  • 相关阅读:
    ABP框架应用-MySQL数据库集成
    redis初识
    MySQL高级学习笔记
    Linux安装apache
    学习jvm(一)--java内存区域
    HashTable、HashMap与ConCurrentHashMap源码解读
    Linux安装禅道项目管理软件
    设计模式之六大原则
    设计模式之策略模式
    设计模式之分类
  • 原文地址:https://www.cnblogs.com/7q4w1e/p/9952269.html
Copyright © 2011-2022 走看看