zoukankan      html  css  js  c++  java
  • mysql改密码

    如果安装好的mysql,需要对密码进行重置

    1.先停mysql      

    service  mysqld   stop;

    2.跳过注册表

    mysqld_safe --skip-grant-tables&

    3.登录mysql

    (1)    mysql -uroot -p

    (2)    回车

    4.刷新权限

    flush privileges;

    5.重置密码

    grant   all   privileges  on  *.*   to   root@‘localhost’  identified  by   '123lqh'   with  grant  option;

    ==========================================================================================

     

    方法1: 用SET PASSWORD命令   

    首先登录MySQL。登陆后不用切换数据库,直接执行以下语句。

    格式:mysql> set password for 用户名@localhost = password('新密码');  

    例子:mysql> set password for root@localhost = password('123');  

     

    方法2:用mysqladmin   

    格式:mysqladmin -u用户名 -p旧密码 password 新密码  

    例子:mysqladmin -uroot -p123456 password 123  

     

     

    方法3:用UPDATE直接编辑user表   

    首先登录MySQL。  

    mysql> use mysql;  

    mysql> update user set password=password('123') where user='root' and host='localhost';  

    mysql> flush privileges; 

     

  • 相关阅读:
    使用selenium模拟登陆12306以及滑块验证
    网络爬虫之requests模块
    网络爬虫简介
    MongoDB基础操作
    redis集群搭建以及常见问题
    redis的主从复制
    Linux下如何安装mysql
    python 序列化模块
    python os模块和sys模块
    python 时间模块
  • 原文地址:https://www.cnblogs.com/linqiuhua/p/7998928.html
Copyright © 2011-2022 走看看