当前位置: 首页 > news >正文

mysql 忘记密码

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

1.结束mysql 服务


service mysqld stop

#或 /etc/init.id/mysqld stop

2. 使用 “--skip-grant-tables”参数重新启动mysql

[root@NetDakVPS ~]# mysqld_safe --skip-grant-tables &
[1] 23810
Starting mysqld daemon with databases from /var/lib/mysql 

3.用root帐号登录mysql

[root@NetDakVPS ~]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 1
Server version: 5.0.77 Source distributionType 'help;' or 'h' for help. Type 'c' to clear the buffer.

4:改变用户数据库

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed 

5:修改密码,记得密码要用password()函数进行加密

mysql> update user set password=password('netdak') where user='root';
Query OK, 1 row affected (0.04 sec)
Rows matched: 1 Changed: 1 Warnings: 0 

六:刷新权限表

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec) 

七:退出mysql

mysql> quit

八:对mysql进行重启

[root@NetDakVPS ~]# service mysqld restart;
STOPPING server from pid file /var/run/mysqld/mysqld.pid
100421 13:44:03 mysqld endedStopping MySQL: [ OK ]
Starting MySQL: [ OK ]
[1]+ Done mysqld_safe --skip-grant-tables 

九:用更改过的密码重新登录即可。

[root@NetDakVPS ~]# mysql -u root -p
Enter password: netdak
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.0.77 Source distributionType 'help;' or 'h' for help. Type 'c' to clear the buffer.mysql> quit
Bye

 

转载于:https://my.oschina.net/u/1867229/blog/979215

相关文章:

  • DNS及bind详解
  • Web前端优化最佳实践及工具集锦(如减少页面加载时间)
  • iOSAFNetworking 网络请求
  • Redis事务
  • 关于百度站长平台升级HTTPS认证工具不得不说的事
  • HttpClient 图讲解明
  • promise和async/await的异步调用方法
  • 记一个toJSONString异常
  • Python连接Oracle
  • php新手入门必读!
  • 如何查看配置文件.mobileprovision的UUID
  • MySQL中一个文档疏漏的分析测试(r13笔记第3天)
  • 使用swoole websocket 实现执行console php文件 把输出返回给浏览器
  • 复习
  • 初识activiti
  • 【知识碎片】第三方登录弹窗效果
  • 5分钟即可掌握的前端高效利器:JavaScript 策略模式
  • C++回声服务器_9-epoll边缘触发模式版本服务器
  • IE报vuex requires a Promise polyfill in this browser问题解决
  • Shell编程
  • Spring Cloud Feign的两种使用姿势
  • Theano - 导数
  • use Google search engine
  • 闭包,sync使用细节
  • 经典排序算法及其 Java 实现
  • 罗辑思维在全链路压测方面的实践和工作笔记
  • 数组大概知多少
  • 突破自己的技术思维
  • 一个JAVA程序员成长之路分享
  • 数据库巡检项
  • #ifdef 的技巧用法
  • $GOPATH/go.mod exists but should not goland
  • $NOIp2018$劝退记
  • (8)STL算法之替换
  • (C#)获取字符编码的类
  • (DenseNet)Densely Connected Convolutional Networks--Gao Huang
  • (MIT博士)林达华老师-概率模型与计算机视觉”
  • (TOJ2804)Even? Odd?
  • (附源码)springboot掌上博客系统 毕业设计063131
  • (附源码)计算机毕业设计SSM疫情社区管理系统
  • (简单) HDU 2612 Find a way,BFS。
  • (论文阅读31/100)Stacked hourglass networks for human pose estimation
  • (使用vite搭建vue3项目(vite + vue3 + vue router + pinia + element plus))
  • (原創) 如何安裝Linux版本的Quartus II? (SOC) (Quartus II) (Linux) (RedHat) (VirtualBox)
  • (转)一些感悟
  • .dat文件写入byte类型数组_用Python从Abaqus导出txt、dat数据
  • .jks文件(JAVA KeyStore)
  • .NET Core WebAPI中使用swagger版本控制,添加注释
  • .NET 除了用 Task 之外,如何自己写一个可以 await 的对象?
  • .NET 应用架构指导 V2 学习笔记(一) 软件架构的关键原则
  • .net安装_还在用第三方安装.NET?Win10自带.NET3.5安装
  • .NET开源快速、强大、免费的电子表格组件
  • /etc/apt/sources.list 和 /etc/apt/sources.list.d
  • [ C++ ] STL_vector -- 迭代器失效问题
  • [ C++ ] STL---stack与queue